AC.Tooltip=Class.create();AC.Tooltip.options={src:"/global/elements/zoomerlay/zoomerlay_tooltip.png",pos:"top",dist:5,deadspace:0};
AC.Tooltip.instances=$A([]);Object.extend(AC.Tooltip.prototype,{initialize:function(d,c){if(!AC.Tooltip.instances.length&&AC.OverlayPanel){this.listenForEvent(AC.OverlayPanel.overlay,"beforePop",true,function(){AC.Tooltip.instances.invoke("stop")
});this.listenForEvent(AC.OverlayPanel.overlay,"afterClose",true,function(){AC.Tooltip.instances.invoke("start")
})}AC.Tooltip.instances.push(this);this.options=Object.extend(Object.clone(AC.Tooltip.options),c);
this.initialized=true;this.links=d;this.activeLink;this.ie6=!!AC.Detector.getAgent().match(/msie\s+6/);
this.links.each(function(a){a.removeAttribute("title")});this.tooltip=$(new Image());
this.tooltip.onload=function(){document.body.appendChild(this.tooltip);this.imgWidth=this.tooltip.width;
this.imgHeight=this.tooltip.height;this.tooltip.setStyle({display:"none",position:"absolute",zIndex:9999,behavior:"none"})
}.bind(this);this.tooltip.src=this.options.src;this.bindMouseMove=this.onMouseMove.bind(this);
this.start()},start:function(){$(document).observe("mousemove",this.bindMouseMove)
},stop:function(){$(document).stopObserving("mousemove",this.bindMouseMove);this.onRollOut()
},isCursorOver:function(k,m){var j=m.cumulativeOffset(),h=j.left,l=j.top,i=j.left+m.getWidth(),n=j.top+m.getHeight();
return(k.pageX>=h&&k.pageX<i&&k.pageY>=l&&k.pageY<n)},isInDeadspace:function(h,e){if(!this.options.deadspace||isNaN(this.options.deadspace)){return false
}var g=e.cumulativeOffset(),f=false;switch(this.options.pos){case"top":f=(h.pageY-g.top<=this.options.deadspace);
break;case"bottom":f=((h.pageY+this.options.deadspace)-(g.top+e.getHeight())>=0);
break;case"left":f=(h.pageX-g.left<=this.options.deadspace);break;case"right":f=((h.pageX+this.options.deadspace)-(g.left+e.getWidth())>=0);
break}return f},onMouseMove:function(d){this.tooltip.setStyle({left:d.pageX+"px",top:d.pageY+"px"});
var c;this.links.each(function(a){if(this.isCursorOver(d,a)&&!this.isInDeadspace(d,a)){c=a;
throw $break}}.bind(this));if(c){if(c!=this.activeLink){if(this.activeLink){this.activeLink.removeClassName("hover")
}this.activeLink=c;this.activeLink.addClassName("hover");if(!this.ie6){this.showTooltip()
}}}else{this.onRollOut()}},onRollOut:function(){if(this.activeLink){this.activeLink.removeClassName("hover");
this.activeLink=null;if(!this.ie6){this.hideTooltip()}}},showTooltip:function(){if(this.effect){this.effect.cancel()
}this.tooltip.setStyle({display:"block",width:0,height:0});this.effect=new Effect.Parallel([new Effect.Appear(this.tooltip,{sync:true}),new Effect.Morph(this.tooltip,{style:{width:this.imgWidth+"px",height:this.imgHeight+"px"},sync:true})],{duration:0.2,afterUpdate:this.setTooltipMargins.bind(this)})
},hideTooltip:function(){if(this.effect){this.effect.cancel()}this.effect=this.effect=new Effect.Morph(this.tooltip,{style:{width:"0px",height:"0px"},duration:0.2,afterUpdate:this.setTooltipMargins.bind(this)});
this.effect=new Effect.Parallel([new Effect.Fade(this.tooltip,{sync:true}),new Effect.Morph(this.tooltip,{style:{width:"0px",height:"0px"},sync:true})],{duration:0.2,afterUpdate:this.setTooltipMargins.bind(this)})
},setTooltipMargins:function(){var f=this.tooltip.getWidth(),e=this.tooltip.getHeight();
switch(this.options.pos){case"top":var d={marginLeft:-Math.round(f/2)+"px",marginTop:-(e+this.options.dist)+"px"};
break;case"bottom":var d={marginLeft:-Math.round(f/2)+"px",marginTop:this.options.dist+"px"};
break;case"left":var d={marginLeft:-(f+this.options.dist)+"px",marginTop:-Math.round(e/2)+"px"};
break;case"right":var d={marginLeft:this.options.dist+"px",marginTop:-Math.round(e/2)+"px"};
break}this.tooltip.setStyle(d)}});Object.extend(AC.Tooltip.prototype,Event.Listener);
