AC.Hoverlay=Class.create();Object.extend(AC.Hoverlay.prototype,AC.OverlayPanel.prototype);
Object.extend(AC.Hoverlay.prototype,{initialize:function(d,a,e,b){this.setValueForKey("overlayId","HoverlayPanel");
this.createOverlay();var e=e||"HoverlayPanel";var c=$$("."+e+"");AC.ViewMaster.Viewer.prototype.initialize.call(this,null,this.swapViewElement,e,{triggerEvent:"click"});
this.options.shouldAnimateContentChange=false},setValueForKey:function(a,b){this[a]=b
},setOverlayShadowImageSrc:function(){},overlayShadowImageSrc:function(){},createOverlay:function(){this.swapViewElement=Builder.node("div",{"class":"overlayPanelContent"});
this.caret=$(Builder.node("div",{"class":"caret"}));this.overlay=$(Builder.node("div",{id:this.overlayId,"class":"overlaypanel "+this.overlayClasses,style:"left:-99999px; top:0;"},[this.swapViewElement,this.caret]))
},triggerClicked:function(a,b){if(a){Event.stop(a)}this.trigger=b;this.superTriggerClicked(a,b);
if(this._isDisplaying){return}this._popPosition=null;this.currentSectionEvent=a
},popPosition:function(){if(!this._popPosition){var c,b=null;var a=this.windowSize();
c=a.x+(a.width-this.defaultWidth-this.padleft-this.padright)/2;b=(a.y+(a.height-this.defaultHeight-this.padtop-this.padbottom)/2);
if(a.height<this.defaultHeight+this.padtop+this.padbottom){}if(b<0||b<20){b=20}this._popPosition={left:c,top:b}
}return this._popPosition},pop:function(c,h,a,g,e){Element.setOpacity(this.overlay,0);
var b=this.caret.clientWidth;var f=document.viewport.getScrollOffsets()[1];var d=this.trigger.cumulativeOffset()[1]+b-f;
if(d<265){this.overlay.addClassName("lowered");b=this.caret.clientWidth;this.overlay.setStyle({left:this.trigger.cumulativeOffset()[0]+this.trigger.clientWidth+(b/2)+"px",top:this.trigger.cumulativeOffset()[1]-(b/2)+"px"});
this.caret.setStyle({left:-b+"px",top:(this.trigger.getHeight()/2)+"px"})}else{this.overlay.removeClassName("lowered");
this.overlay.setStyle({left:this.trigger.cumulativeOffset()[0]-(this.trigger.clientWidth/2)+"px",top:this.trigger.cumulativeOffset()[1]-this.overlay.getHeight()+b+"px"});
this.caret.setStyle({left:(this.trigger.clientWidth+b)/2+"px",top:this.overlay.getHeight()+"px"})
}hoverlayTimer=window.setTimeout(this.popEffect.bind(this),300);this.closeHoverlay=this.startClose.bindAsEventListener(this);
Event.observe(document,"click",this.closeHoverlay)},afterPop:function(b,a){this.currentSection.content.style.visibility="visible";
this.setPoppedClass()},startClose:function(a){if(!(a.findElement("#HoverlayPanel"))&&!(a.findElement(".HoverlayPanel"))){window.clearTimeout(hoverlayTimer);
this.close(a)}},popEffect:function(){new Effect.Appear(this.overlay,{duration:0.3,beforeStart:this.beforePop.bind(this),afterFinish:this.afterPop.bind(this)})
},close:function(a){if(this._isDisplaying==true){if(a){Event.stop(a)}}Event.stopObserving(document,"click",this.closeHoverlay);
this.willClose(this);if(!AC.Detector.isiPhone()){Element.setOpacity(this.overlay,0);
if(this.overlay.hasClassName("lowered")){this.overlay.removeClassName("lowered")
}this.afterClose()}else{this.afterClose()}},afterClose:function(){Element.removeClassName(this.overlay,"isanim");
Element.removeClassName(this.overlay,"popped");Element.removeClassName(this.overlay,"lowered");
if(this.currentSection){this.overlay.removeClassName(this.currentSection.id)}this.setOverlayShadowImageSrc(null);
this.overlay.style.width="";this.overlay.style.height="";this.overlay.style.left="-99999px";
this.overlay.style.top="0";this.overlay.style.display="";this.dispatchEvent("afterClose",this);
if(AC.Detector.isWebKit()){this.fixSafarisScrollBars()}this.show(null,true);document.body.removeChild(this.overlay);
this._isDisplaying=false}});Event.onDOMReady(function(){AC.Hoverlay.overlay=new AC.Hoverlay()
});
