cm=null;
height=0;
hide_delay=100;
tstat=0;

isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

function switchDiv(objElement,bolVisible){
  if(isNS4||isIE4){
     if(!bolVisible) {
        objElement.visibility ="hidden"
        objElement.style.height=height;
     } else {
        objElement.visibility ="visible"
     }     
  } else if (isIE5 || isNS6) {
     if(!bolVisible){
        objElement.style.display = "none";
        objElement.style.height=height;
     } else {
        objElement.style.display = "";
     }
  }
  return 1;
}

function getPos(el,sProp) {
    var iPos = 0;
    while (el!=null) {
        iPos+=el["offset" + sProp]
        el = el.offsetParent
    }
    return iPos

}

function getelementbyid(myid) {
   if (isNS4){
        objElement = document.layers[myid];
     }else if (isIE4) {
        objElement = document.all[myid];
     }else if (isIE5 || isNS6) {
             objElement = document.getElementById(myid);
     }
return(objElement);
}

function show(el,mid,down) {
var m;
 if (cm!=null) {
    switchDiv(cm,false);
 }
 if (mid!=null) {
     m=getelementbyid(mid);
     if(down){
         height=m.offsetHeight;
         if(height==0) height=m.style.height.substring(0,m.style.height.length-2);
         m.style.left = (getPos(el,"Left")-30)+"px";
         m.style.top=(getPos(el,"Top")-height-5)+"px";
     }else{
         height=m.offsetHeight;
         if(height==0) height=m.style.height.substring(0,m.style.height.length-2);
         m.style.left = (getPos(el,"Left")-30)+"px";
         m.style.top =  getPos(el,"Top")+el.offsetHeight+2+"px";
     }
     switchDiv(m,true);
     cm=m;
 }
}


function hidemenu(id) {
timer1=setTimeout("show(null,null,false)",hide_delay);
tstat=1;
return 1;
}

function cancelhide() {
 if (tstat==1) {
 clearTimeout(timer1);
 tstat=0;
 }
return 1;
}

