var expire_today = new Date();
var expire_year = new Date(expire_today.getTime()+365*24*60*60*1000);

function ExpandNC(ID){ hide(ID+"_show"); show(ID+"_hide");show(ID);}
function Expand(ID){
  hide(ID+"_show"); show(ID+"_hide");show(ID);
  SetCookie(ID,'on');
}

function ContractNC(ID){ hide(ID+"_hide"); show(ID+"_show");hide(ID); }
function Contract(ID){
  hide(ID+"_hide"); show(ID+"_show");hide(ID);
  DeleteCookie(ID);
}
function CheckMenu(ID){
  if(GetCookie(ID)=='on')Expand(ID);
}

function hide(ID1){
  obj1=document.getElementById(ID1);
  if(obj1!=null){    obj1.style["display"]='none'; }

}
function show(ID1){
  obj1=document.getElementById(ID1);
  if(obj1!=null){   obj1.style["display"]=''; }
}
function GetCookie(name){
  var arg=name+"=";
  var alen=arg.length;
  var clen=document.cookie.length;
  var i=0;
  var j;
  while(i<clen){
    j=i+alen;
    if(document.cookie.substring(i,j)==arg){
      return getCookieVal(j);
    }
    i=document.cookie.indexOf(" ",i)+1;
    if(i==0)break;
  }
  return null;
}
function DeleteCookie(name,path,domain){
  if(GetCookie(name)){
    document.cookie=name+"="+
      ((path)?"; path="+path : "")+
      ((domain)?"; domain="+domain:"")+
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";      
  }
}
function SetCookie(name,value,expires,path,domain,secure){
  document.cookie=name+"="+escape(value)+"; expires="+
    ((expires)?expires.toGMTString():expire_year.toGMTString())+
    ((path)?"; path="+path : "")+
    ((domain)?"; domain="+domain:"")+
    ((secure)?"; secure":"");   
}
function getCookieVal(offset){
  var endstr=document.cookie.indexOf(";", offset);
  if(endstr==-1){endstr=document.cookie.length;}
  return unescape(document.cookie.substring(offset,endstr));
}
