function menu_act(active,basename) {
   if ((active!=-1)&& (selitem == active)) {
      selitem = -1;
      active = -1;
   }
   var z,what;
   z=beginy;
   eval('var items_arr = '+basename);
   for (i=0;i<items_arr.length; i++) {
      //Setting main menu properties
      what = "l"+basename+i;
      if(isMinNS4 && (!isNS6)) {
         layer = document.layers[what];
      } else {
         layer = (document.getElementById)? document.getElementById(what) : document.all[what];
      }     
      if (isMinNS4 && (!isNS6)) {
        layer.visibility = "show";
        layer.top=z;
      }
      if (isNS6) {
        document.getElementById(what).style.visibility = "visible";
        document.getElementById(what).style.top = z;
      }
      if (isMinIE4) {
        layer.style.visibility = "visible";
        layer.style.top = z;
      }
      if (isMinNS4 && (!isNS6)) {             
        cmheight = getHeight(layer);
      }
      if (isNS6) {
        nObj = document.getElementById(what);
        cmheight = getHeight(nObj);
      }
      if (isMinIE4) {
        cmheight = getHeight(layer);
      }           
//      if (!mheight) {
//         cmheight = mheight;
//      }
      z = z+cmheight;    
      //Setting child menu properties
      if (items_arr[i].length>1) {
        what = "lc"+basename+i;
        if(isMinNS4 && (!isNS6)) {
           layer = document.layers[what];
        } else {
           layer = (document.getElementById)? document.getElementById(what) : document.all[what];
        }     
        if (i==active) {
           selitem = active;
           if(isMinNS4 && (!isNS6)) {
             document.layers['l'+basename+i].document.images[0].src='img/minus.gif';
           } else {
             document.images['img'+basename+i].src='img/minus.gif';
           }
           if (isMinNS4 && (!isNS6)) {             
             childheightall = getHeight(layer);
           }
           if (isNS6) {
             nObj = document.getElementById(what);
             childheightall = getHeight(nObj);
           }
           if (isMinIE4) {
             childheightall = getHeight(layer);
           }
           if (!childheightall) childheightall = (items_arr[i].length-1)*heightperitem+childheightplus;
           if (isMinNS4 && (!isNS6)) {
             layer.visibility = "show";
             layer.top=z;
           }
           if (isNS6) {
             document.getElementById(what).style.visibility = "visible";
             document.getElementById(what).style.top = z;
           }
           if (isMinIE4) {
             layer.style.visibility = "visible";
             layer.style.top = z;
           }
           z = z+childheightall;    
        } else {
           if(isMinNS4 && (!isNS6)) {
             document.layers['l'+basename+i].document.images[0].src='img/plus.gif';
           } else {
             document.images['img'+basename+i].src='img/plus.gif';
           }
           if (isMinNS4 && (!isNS6)) {
             layer.visibility = "hide";
           }
           if (isNS6) {
             document.getElementById(what).style.visibility = "hidden";
           }
           if (isMinIE4) {
             layer.style.visibility = "hidden";
           }
        }
      }

   }
}


function getHeight(ele){ 
  var h=0; 
  if(ele.offsetHeight){ 
     h=ele.offsetHeight; 
  } else if(ele.clip && ele.clip.height){ 
     h=ele.clip.height; 
  }else if(ele.style && ele.style.pixelHeight){ 
      h=ele.style.pixelHeight; 
  } 
  return parseInt(h); 
}

function get_max_height(basename) {
   res = 0;
   max_child_height=0;
   eval('var items_arr = '+basename);
   for (i=0;i<items_arr.length; i++) {
      what = "l"+basename+i;
      what_c = "lc"+basename+i;
      if(isMinNS4 && (!isNS6)) {
         layer = document.layers[what];
         layer_c = document.layers[what_c];
      } else {
         layer = (document.getElementById)? document.getElementById(what) : document.all[what];
         layer_c = (document.getElementById)? document.getElementById(what_c) : document.all[what_c];
      }     
      if (isMinNS4 && (!isNS6)) {             
         cmheight = getHeight(layer);
         chheight = getHeight(layer_c);
      }
      if (isNS6) {
         nObj = document.getElementById(what);
         cmheight = getHeight(nObj);
         nObj_c = document.getElementById(what_c);
         chheight = getHeight(nObj_c);
      }
      if (isMinIE4) {
         cmheight = getHeight(layer);
         chheight = getHeight(layer_c);
      }
      if (!cmheight) cmheight = mheight;
      if (!chheight) chheight = (items_arr[i].length-1)*heightperitem+childheightplus;;
      if (chheight>max_child_height) max_child_height = chheight;
      res = res+cmheight;    
   }   
   res = res + max_child_height;
   return res;
}