function p_o(ah)
{
return document.getElementById(ah);
}
// broser test, thanks to cross-browser.com
var ab,z,xIE4Up,xIE4,xIE5,xNN4,xUA=navigator.userAgent.toLowerCase();
if(window.opera){
var ae=xUA.indexOf('opera');
if(ae!=-1){
var aj=parseInt(xUA.charAt(ae+6));
ab=aj>=7;
z=aj<7;
}
}else if(navigator.vendor!='KDE'&&document.all&&xUA.indexOf('msie')!=-1){
xIE4Up=parseFloat(navigator.appVersion)>=4;
xIE4=xUA.indexOf('msie 4')!=-1;
xIE5=xUA.indexOf('msie 5')!=-1;
}else if(document.layers){
xNN4=true;
}
xMac=xUA.indexOf('mac')!=-1;
/**
 * Class TimeoutMethod
 */
var timeoutStack=new Array();
function Timeout(obj,w,v)
{
this.obj=obj;
this.w=w;
this.q=-1;
var ae,ai;
for(ae=0,ai=timeoutStack.length;ae<ai;ae++){
if(!timeoutStack[ae]){
this.q=ae;
break;
}
}
if(this.q<0){
this.q=timeoutStack.length;
}
timeoutStack[this.q]=this;
this.s=setTimeout("timeoutStack["+this.q+"].call()",v);
}
Timeout.prototype.call=function()
{
eval("this.obj."+this.w);
timeoutStack[this.q]=null;
}
Timeout.prototype.clear=function()
{
clearTimeout(this.s);
timeoutStack[this.q]=null;
}
/**
 * Class PopMenu
 */
var a=false;
var h=false;
function PopMenu(l,f,k,j)
{
this.l=l;
this.f=f;
this.p=false;
this.m=false;
this.d=false;
this.b=false;
this.k=k;
this.j=j;
YAHOO.util.Event.addListener(this.f,"mouseover",YAHOO.sanatate.popup.onMouseOver);
YAHOO.util.Event.addListener(this.f,"mouseout",YAHOO.sanatate.popup.e);
YAHOO.util.Event.addListener(this.f,"click",YAHOO.sanatate.popup.e);// for opera
}
PopMenu.prototype.show=function()
{
if(a){
this.onMouseOver();
}else if(!this.d){
this.d=new Timeout(this,"onMouseOver()",500);
}
}
PopMenu.prototype.hide=function()
{
if(this.d){
this.d.clear();
this.d=false;
}
this.e();
}
PopMenu.prototype.onMouseOver=function()
{
if(!h){
return false;
}
if(a&&a!=this){
a.hideNow();
}
a=this;
this.p=true;
if(this.b){
this.b.clear();
this.b=false;
}
if(!this.m&&!this.i){
this.u();
}
return true;
}
PopMenu.prototype.e=function()
{
if(!h){
return false;
}
this.p=false;
if(!this.i&&!this.b){
this.b=new Timeout(this,"animHide()",200);
}
}
PopMenu.prototype.u=function()
{
var x=parseInt(YAHOO.util.Dom.getStyle(this.l,"width"));
var y=parseInt(YAHOO.util.Dom.getStyle(this.l,"height"));
var ag=YAHOO.util.Dom.getX(this.l);
var af=YAHOO.util.Dom.getY(this.l);
var aa=this.k;
var ac=this.j;

var dl = (x-aa)/2;
var dl_diff = Math.abs(dl) - Math.abs(ag);

if (dl_diff > 0) {
 var dl = dl + dl_diff;
}


YAHOO.util.Dom.setStyle("popup","width",x);
YAHOO.util.Dom.setStyle("popup","height",y);
YAHOO.util.Dom.setStyle("popup","display","block");
var r={
points:{from:[ag,af],by:[dl,y]},
width:{from:x,to:aa},
height:{from:y,to:ac}
};
this.i=new YAHOO.util.Motion("popup",r,0.1);
this.i.onComplete.subscribe(this.o,this,true);
this.i.animate();
}
PopMenu.prototype.o=function()
{
if(this.i){
this.i=false;
if(this.p){
YAHOO.util.Dom.setStyle(this.f,"display","block");
YAHOO.util.Dom.setXY(this.f,YAHOO.util.Dom.getXY("popup"));
if(xIE4Up){
// fix for droplists in ie
YAHOO.util.Dom.setStyle("popup_ie","display","block");
YAHOO.util.Dom.setXY("popup_ie",YAHOO.util.Dom.getXY("popup"));
YAHOO.util.Dom.setStyle("popup_ie","width",this.k);
YAHOO.util.Dom.setStyle("popup_ie","height",this.j);
}
this.p=false;
this.m=true;
}else{
this.animHide();
}
}
}
PopMenu.prototype.hideNow=function()
{
this.p=false;
this.m=false;
if(this.b){
this.b.clear();
this.b=false;
}
if(this.i){
this.i.stop();
this.i=false;
}
YAHOO.util.Dom.setStyle(this.f,"display","none");
if(xIE4Up){
// fix for ie
YAHOO.util.Dom.setStyle("popup_ie","display","none");
}
}
PopMenu.prototype.animHide=function()
{
YAHOO.util.Dom.setStyle(this.f,"display","none");
if(xIE4Up){
// fix for ie
YAHOO.util.Dom.setStyle("popup_ie","display","none");
}
var x=this.k;
var y=this.j;
var aa=parseInt(YAHOO.util.Dom.getStyle(this.l,"width"));
var ac=parseInt(YAHOO.util.Dom.getStyle(this.l,"height"));
var r={
points:{by:[(x-aa)/2,-ac]},
width:{from:x,to:aa},
height:{from:y,to:ac}
};
this.i=new YAHOO.util.Motion("popup",r,0.1);
this.i.onComplete.subscribe(this.n,this,true);
this.i.animate();
}
PopMenu.prototype.n=function()
{
if(this.i){
this.i=false;
this.m=false;
YAHOO.util.Dom.setStyle("popup","display","none");
if(xIE4Up){
// fix for ie
YAHOO.util.Dom.setStyle("popup_ie","display","none");
}
a=false;
}
}
/**
 * Init
 */
YAHOO.namespace("sanatate.popup");
YAHOO.sanatate.popup.onMouseOver=function()
{
if(a){
a.onMouseOver();
}
}
YAHOO.util.Event.addListener("popup","mouseover",YAHOO.sanatate.popup.onMouseOver);
YAHOO.sanatate.popup.e=function()
{
if(a){
a.e();
}
}
YAHOO.util.Event.addListener("popup","mouseout",YAHOO.sanatate.popup.e);
YAHOO.sanatate.popup.windowLoad=function()
{
h=true;
}
YAHOO.util.Event.addListener(window,'load',YAHOO.sanatate.popup.windowLoad);
