cm = new Array();

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"
     } 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 show(el,m, depth, xoffset, yoffset) {



 for (var i=depth; i<10; i++) {
   if (cm[i]!=null) {
     switchDiv(cm[i],false);
   }
 }

 if (m!=null) {
 var nn;


 var s1_lim=19;
 var s2_lim=32;
 var s3_lim=59;
 var heightplus=0;

 if (navigator.userAgent.indexOf("MSIE")>-1) {
     var ad1=7;
     var ad2=21;
     var ad3=30;
     var left1=-1;
     if(depth==0) var heightplus=11;
     else  var heightplus=11;
 }
 else {
     var ad1=0;
     var ad2=11;
     var ad3=26;
     var left1=-1;
 }




 var ll=xoffset+left1;

 mm=m;
 m=getelementbyid(m);
 m.style.left = getPos(el,"Left")+ll+"px";


 nn=el.offsetHeight + heightplus;
 if (el.offsetHeight>s3_lim) nn=el.offsetHeight + heightplus;
 else if (el.offsetHeight<=s1_lim) nn=el.offsetHeight-ad1 + heightplus;
 else if (el.offsetHeight>s1_lim && el.offsetHeight<=s2_lim) nn=el.offsetHeight-ad2 + heightplus;
 else if (el.offsetHeight>s2_lim && el.offsetHeight<=s3_lim) nn=el.offsetHeight-ad3 + heightplus;


 //document.form2.k.value=el.offsetHeight+" "+nn+" "+mm;

 m.style.top =  getPos(el,"Top")+nn+yoffset+"px";
 switchDiv(m,true);
 cm[depth]=m;
 }

}

function im(numer, qthis)
{
  document.getElementById('img_menu'+numer).src='/images/minmenu_on.gif';
  document.getElementById('text_menu'+numer).className='cprt3';
  qthis.style.background = '#135a9c';
  return 1;
};

function imo(numer, qthis)
{
  document.getElementById('img_menu'+numer).src='/images/minmenu_off.gif';
  document.getElementById('text_menu'+numer).className='cprt2';
  qthis.style.background = '#dcdcdc';
  return 1;
};


function hidemenu(depth) {

show(null,null, depth)

//timer1=setTimeout("show(null,null)",hide_delay);
//tstat=1;
return 1;
}

function hidemenuto(depth) {
 for (var i=9;i>=depth;i--) show(null,null, i);
}

function cancelhide() {
 if (tstat==1) {
 clearTimeout(timer1);
 tstat=0;
 }
return 1;
}

