/*--------------------------------------------------------------------------*
 * 
 * Copyright (C) 2008 Brand Labs LLC
 * 
 * Menu Pop Out (Willard)
 * 
 * Version 1.0.2
 * 
 *--------------------------------------------------------------------------*/
var WillardMenu=Class.create({initialize:function(aa,ba){this.headerElement=aa;this.headerElementPosition=null;this.menuElement=ba;this.menuFinalVisibility=false;this.mouseMoveWrapper=null;try{this.bodyElement=$$('body').first();}
catch(e){return;}
if(this.headerElement==null||this.menuElement==null||this.bodyElement==null){return;}
this.queueName=this.headerElement.identify();Event.observe(this.headerElement,'mouseover',this.mouseIn.bindAsEventListener(this));},mouseIn:function(){var ca=null;var da=this.headerElement;var ea=this.menuElement;if(this.menuFinalVisibility){return;}
ca=da.positionedOffset();this.headerElementPosition=ca;ea.setStyle({position:'absolute',left:ca.left+'px',top:(ca.top+da.getHeight())+'px',opacity:'1.0'});this.mouseMoveWrapper=this.mouseMove.bindAsEventListener(this);Event.observe(this.bodyElement,'mousemove',this.mouseMoveWrapper);this.showElement(ea);},mouseMove:function(fa){var x;var y;var ga=this.menuElement;var ha=this.headerElement;if(!this.menuFinalVisibility){return;}
x=Event.pointerX(fa);y=Event.pointerY(fa);if(this.boundsCheck(x,y,ga,ga.positionedOffset())||this.boundsCheck(x,y,ha,this.headerElementPosition)){return;}
if(this.mouseMoveWrapper!=null){Event.stopObserving(this.bodyElement,'mousemove',this.mouseMoveWrapper);}
this.mouseMoveWrapper=null;this.hideElement(ga);},boundsCheck:function(x,y,ia,ja){var ka=ja;var la={};var ma=false;var na=false;var oa=false;var pa=false;if(ia==null){return false;}
if(arguments[3]){la=arguments[3];}
ma=la['excludeLeftEdge']?(x>ka.left):(x>=ka.left);na=la['excludeRightEdge']?(x<(ka.left+ia.getWidth())):(x<=(ka.left+ia.getWidth()));oa=la['excludeTopEdge']?(y>ka.top):(y>=ka.top);pa=la['excludeBottomEdge']?(y<(ka.top+ia.getHeight())):(y<=(ka.top+ia.getHeight()));if(ma&&na){if(oa&&pa){return true;}}
return false;},showElement:function(qa){this.menuFinalVisibility=true;qa.show();},hideElement:function(ra){this.menuFinalVisibility=false;ra.hide();}});