cm1=null;
cm2=null;

hide_delay=500;

tstat1=0;
tstat2=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"
     } else {
       objElement.visibility ="visible"
     }
 } else if (isIE5 || isNS6) {
      if(!bolVisible){
         objElement.style.display = "none";

      } 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 show1(el,m) {
show2(null,null);
if (cm1!=null) {
 switchDiv(cm1,false);
 }

 if (m!=null) {
 m=getelementbyid(m);m.style.left = getPos(el,"Left")+"px";
 m.style.top =  getPos(el,"Top")+el.offsetHeight+"px";
 switchDiv(m,true);
 cm1=m;
 }
}

function show2(el,m) {
if (cm2!=null) {
 switchDiv(cm2,false);
 }

 if (m!=null) {
 m=getelementbyid(m);m.style.left = (getPos(el,"Left")+el.offsetWidth)+"px";
 m.style.top =  getPos(el,"Top")+"px";
 switchDiv(m,true);
 cm2=m;
 }
}


function hidemenu() {

timer1=setTimeout("show1(null,null)",hide_delay);
timer2=setTimeout("show2(null,null)",hide_delay);
tstat1=1;
tstat2=1;
return 1;
}

function cancelhide() {

if (tstat1==1) {
 clearTimeout(timer1);
 tstat1=0;
 }
 if (tstat2==1) {
 clearTimeout(timer2);
 tstat2=0;
 }
 return 1;
}

