function show_hide_desc(id) {
 id_num = id.split("-")[1];
 prefix = id.split("-")[0];
 id_desc = id+"-open"; 

 if (document.getElementById(id_desc).style.display == "none") {
  SetCookie("show_menu", id, expiration, "", "","");
  for (i=1; i<=100; i++) {
   if (document.getElementById(prefix+"-"+i+"-open")) {
    animatedcollapse.addDiv(prefix+"-"+i+"-open", "fade=1,speed=750");   
    document.getElementById(prefix+"-"+i).className = "inactive";
   }
  }
  
  document.getElementById(id).className = "active";  
  animatedcollapse.ontoggle=function($, divobj, state) { }
  animatedcollapse.init();  

  for (i=1; i<=100; i++) {
   if (document.getElementById(prefix+"-"+i+"-open")) {
    if (i != id_num) {
     animatedcollapse.hide([prefix+"-"+i+"-open"]);
    }
   } 
  }  
  
  animatedcollapse.show([id_desc]);  

 } else {    
    if (document.getElementById(id).className == "active") {
     SetCookie("show_menu", "", expiration, "", "","");
   if(!animatedcollapse.divholders[id_desc]){
     animatedcollapse.addDiv(id_desc, "fade=1,speed=750");  
     animatedcollapse.ontoggle=function($, divobj, state) { }
     animatedcollapse.init();  
   }
     

     animatedcollapse.hide([id_desc]);
     document.getElementById(id).className = "inactive";
    }   
   }
}

function hide_desc(id) {
 SetCookie("show_menu", "", expiration, "", "","");

 if(!animatedcollapse.divholders[id]){
   animatedcollapse.addDiv(id, "fade=1,speed=750");  
   animatedcollapse.ontoggle=function($, divobj, state) { }
   animatedcollapse.init();  
 }
 animatedcollapse.hide([id]);
}

function chek_onload_menu() {
var cookie_val = GetCookie("show_menu");
 if(cookie_val){
  document.getElementById(cookie_val).className = "active";
  document.getElementById(cookie_val+'-open').style.display = "block";
  
 }
}
