var prev= null;

function Get_Cookie(name)
{
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}

function Set_Cookie(name,value,expires,path,domain,secure)
{
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}

window.onload=function(){

  if(document.getElementById)
    {
      var menufilter = document.getElementById("menufilter");
      if (menufilter!=null) {
        //menufilter.className="jsenable";
        BuildList();
      }
    }

}


function BuildList(){

  var hs=document.getElementById("menufilter").getElementsByTagName("h5");
  for(var i=0;i<hs.length;i++) {

    hs[i].onclick=function() {
      
      var expandList;
      expandList = Get_Cookie('expandList');
   
      if(this.parentNode.className!="show") {
        this.parentNode.className="show";
        //expandList = expandList + '|' + this.id + '|' ;
      }
      else {
        this.parentNode.className="hide";
        //expandList = expandList.replace('|' + this.id + '|','');
      }

      if (this.id=="remove") {
        expandList='';
        
      }

      //Set_Cookie('expandList',expandList);

    }

  }

  /*
  var expandList = Get_Cookie('expandList');

  if (expandList==null) expandList='';
  expandList = expandList.replace('||','|');
  var arrexpand = expandList.split("|");

  var id; 
  for (var i=0; i<arrexpand.length; i++) 
  { 
    id = arrexpand[i];
    if (id!='') {
      var elemento = document.getElementById(id);
      if (elemento!=null) {
		    elemento.parentNode.className = "show";
      }
    }
  } 
  */



}
