var _QH_ERROR_MESSAGE="Oops.. there was a problem with your request.<br /><br />Please try again.<br /><br /><em>Click anywhere to close.</em>";var _QH_RESIZE_DURATION=200;var _QH_INITIAL_WIDTH=1;var _QH_INITIAL_HEIGHT=1;var _QH_CONTENTS_WIDTH=330;var _QH_CONTENTS_HEIGHT=400;var _QH_DEF_CONTENTS_WIDTH=330;var _QH_DEF_CONTENTS_HEIGHT=400;var _QH_ANIMATE_CAPTION=true;var _QH_EVAL_SCRIPTS=false;var _QH_EVAL_RESPONSE=false;var EC_QuickHelp={init:function(a){this.options=Object.extend({resizeDuration:_QH_RESIZE_DURATION,initialWidth:_QH_INITIAL_WIDTH,initialHeight:_QH_INITIAL_HEIGHT,contentsWidth:_QH_CONTENTS_WIDTH,contentsHeight:_QH_CONTENTS_HEIGHT,defContentsWidth:_QH_DEF_CONTENTS_WIDTH,defContentsHeight:_QH_DEF_CONTENTS_HEIGHT,animateCaption:_QH_ANIMATE_CAPTION,evalScripts:_QH_EVAL_SCRIPTS,evalResponse:_QH_EVAL_RESPONSE},a||{});this.anchors=[];$A($$("a")).each(function(c){if(c.rel&&c.href&&c.rel.test("^quickhelp","i")){c.onclick=this.click.pass(c,this);this.anchors.push(c);}},this);this.eventKeyDown=this.keyboardListener.bindWithEvent(this);this.eventPosition=this.position.bind(this);this.overlay=new Element("div").setProperty("id","qh_overlay").injectInside(document.body);this.center=new Element("div").setProperty("id","qh_center").setStyles({width:this.options.initialWidth+"px",height:this.options.initialHeight+"px",marginLeft:"-"+(this.options.initialWidth/2)+"px",display:"none"}).injectInside(document.body);this.bg=new Element("div").setProperty("id","qh_bg").injectInside(this.center);this.contents=new Element("div").setProperty("id","qh_contents").injectInside(this.bg);this.closelink=new Element("a").setProperties({id:"qh_close_link",href:"#"}).setStyles({opacity:0}).injectInside(this.center);this.bottom=new Element("div").setProperty("id","qh_bottom").setStyle("display","none").injectInside(document.body);new Element("div").setStyle("clear","both").injectInside(this.bottom);this.error=new Element("div").setProperty("id","qh_error").setHTML(_QH_ERROR_MESSAGE);this.closelink.onclick=this.overlay.onclick=this.close.bind(this);var b=this.nextEffect.bind(this);this.fx={overlay:this.overlay.effect("opacity",{duration:500}).hide(),resize:this.center.effects({duration:this.options.resizeDuration,onComplete:b}),contents:this.contents.effect("opacity",{duration:500,onComplete:b}),closelink:this.closelink.effect("opacity",{duration:500,onComplete:b})};this.ajaxRequest=Class.empty;},click:function(a){return this.open(a.href,a.title,a.rel);},open:function(c,a,d){this.full_href=c;var b=c.split("#");this.href=b[0];this.title=a;this.rel=d;this.position();this.setup(true);this.top=window.getScrollTop()+(window.getHeight()/15);this.center.setStyles({top:this.top+"px",display:""});this.fx.overlay.custom(0.8);return this.loadContents();},position:function(){this.overlay.setStyles({top:window.getScrollTop()+"px",height:window.getHeight()+"px"});},setup:function(a){var c=$A($$("object"));c.extend($$(window.ActiveXObject?"select":"embed"));c.each(function(d){d.style.visibility=a?"hidden":"";});var b=a?"addEvent":"removeEvent";window[b]("scroll",this.eventPosition)[b]("resize",this.eventPosition);document[b]("keydown",this.eventKeyDown);this.step=0;},loadContents:function(){if(this.step){return false;}this.step=1;var d=this.rel.match(/[0-9]+/g);this.options.contentsWidth=(d&&(d[0]>0))?d[0]:this.options.defContentsWidth;this.options.contentsHeight=(d&&(d[1]>0))?d[1]:this.options.defContentsHeight;this.bottom.setStyles({opacity:"0",height:"0px",display:"none"});this.center.className="mb_loading";this.fx.contents.hide();var c=this.nextEffect.bind(this);var b=this.ajaxFailure.bind(this);var a={method:"get",update:this.contents,evalScripts:this.options.evalScripts,evalResponse:this.options.evalResponse,onComplete:c,onFailure:b};this.ajaxRequest=new Ajax(this.href,a).request();return false;},ajaxFailure:function(){this.contents.setHTML("");this.error.clone().injectInside(this.contents);this.nextEffect();this.center.setStyle("cursor","pointer");this.bottom.setStyle("cursor","pointer");this.center.onclick=this.bottom.onclick=this.close.bind(this);},nextEffect:function(){switch(this.step++){case 1:this.center.className="";this.center.setStyle("cursor","default");this.bottom.setStyle("cursor","default");this.center.onclick=this.bottom.onclick="";this.contents.setStyles({width:this.options.contentsWidth+"px",height:this.options.contentsHeight+"px"});if(this.center.clientHeight!=this.contents.offsetHeight){this.fx.resize.custom({height:[this.center.clientHeight,this.contents.offsetHeight]});break;}this.step++;case 2:if(this.center.clientWidth!=this.contents.offsetWidth){this.fx.resize.custom({width:[this.center.clientWidth,this.contents.offsetWidth],marginLeft:[-this.center.clientWidth/2,-this.contents.offsetWidth/2-10]});break;}this.step++;case 3:this.bottom.setStyles({top:(this.top+this.center.clientHeight)+"px",width:this.contents.style.width,marginLeft:this.center.style.marginLeft,display:""});this.fx.contents.custom(0,1);this.fx.closelink.custom(0,1);break;case 4:var a=$$(".item");var e=a[a.length-2];var f=e.getCoordinates();var c=this.options.contentsHeight-f.height-103;e=a[a.length-1];e.setStyle("height",c+"px");var b=this.full_href.split("#");if("a_name_"+b[1]){var d=new Fx.Scroll("qh_container",{wait:false,duration:400}).toElement("a_name_"+b[1]);}this.step=0;}},keyboardListener:function(a){if((a.control&&a.key=="w")||(a.control&&a.key=="x")||(a.key=="esc")){this.close();a.stop();}},close:function(){if(this.step<0){return;}this.step=-1;for(var a in this.fx){this.fx[a].clearTimer();}this.center.style.display=this.bottom.style.display="none";this.center.className="qh_loading";this.fx.overlay.chain(this.setup.pass(false,this)).custom(0);this.center.setStyles({width:this.options.initialWidth+"px",height:this.options.initialHeight+"px",marginLeft:"-"+(this.options.initialWidth/2)+"px",display:"none"});this.closelink.setStyle("opacity",0);return false;}};window.addEvent("domready",EC_QuickHelp.init.bind(EC_QuickHelp));