
function expstickybar(usersetting){var setting=jQuery.extend({position:'bottom',peekamount:30,revealtype:'mouseover',speed:200},usersetting);var thisbar=this;var cssfixedsupport=!document.all||document.all&&document.compatMode=="CSS1Compat"&&window.XMLHttpRequest;if(!cssfixedsupport||window.opera){return;}
jQuery(function(){if(setting.externalcontent){thisbar.ajaxstickydiv=jQuery('<div id="ajaxstickydiv_'+setting.id+'"></div>').appendTo(document.body);thisbar.loadcontent(setting);}
else{thisbar.init(jQuery,setting);}})}
expstickybar.prototype={loadcontent:function(setting){var thisbar=this;var ajaxfriendlyurl=setting.externalcontent.replace('/^http:\/\/[^\/]+\//i',"http://"+window.location.hostname+"/");jQuery.ajax({url:ajaxfriendlyurl,async:true,error:function(ajaxrequest){alert('Error fetching Ajax content.<br />Server Response: '+ajaxrequest.responseText);},success:function(content){thisbar.ajaxstickydiv.html(jQuery(content).find("#CommunityContent").html())
thisbar.init(jQuery,setting);jQuery("#stickybartitle").html(setting.title);}})},showhide:function(keyword,anim){var thisbar=this;var finalpx=(keyword=="show")?0:-(this.height-this.setting.peekamount);var positioncss=(this.setting.position=="bottom")?{bottom:finalpx}:{top:finalpx}
thisbar.stickybar.stop().animate(positioncss,(anim)?this.setting.speed:0,function(){thisbar.indicators.each(function(){var indicator=jQuery(this)
indicator.attr('src',(thisbar.currentstate=="show")?indicator.attr('data-closeimage'):indicator.attr('data-openimage'))})})
thisbar.currentstate=keyword},toggle:function(){var state=(this.currentstate=="show")?"hide":"show"
this.showhide(state,true)},init:function(jQuery,setting){var thisbar=this
this.stickybar=jQuery('#'+setting.id).css('visibility','visible')
this.height=this.stickybar.outerHeight()
this.currentstate="show"
setting.peekamount=Math.min(this.height,setting.peekamount)
this.setting=setting
if(setting.revealtype=="mouseover")
this.stickybar.bind("mouseenter mouseleave",function(e){thisbar.showhide((e.type=="mouseenter")?"show":"hide",true)})
this.indicators=this.stickybar.find('img[data-closeimage]')
this.stickybar.find('#togglebar').bind('click',function(){thisbar.toggle()
return false})
setTimeout(function(){thisbar.height=thisbar.stickybar.outerHeight()},1000)
this.showhide("show")}}
