LIST_COUNT =0;
selected =-1;
var real_value ="none";
isExpanded= new Array();

function retrieve_field(obj) {
 real_value ="none";
 var cookie = ''
 cookie = document.cookie;
 if(cookie)
 {
  var offset_start = cookie.indexOf(obj + '~');
  if (offset_start == -1) return 1;
  objStr = new String(obj)
  var offset_start_length = objStr.length + 1;
  offset_start = offset_start + offset_start_length;
  var offset_end = cookie.indexOf('|', offset_start);
  real_value = cookie.substring(offset_start, offset_end);
 }
 return real_value;
}

function domousedown () {
 e=event.srcElement;
 while (e.tagName!="LI" && e.tagName!=null){e=e.parentElement};
 if(e.className=="fileonly")
 {
  return true;
 }
 else if(e.className=="plus")
 {
  children= eval(e.hasChild);
  if(children)
  {
   lookup= eval(e.lookup)
   child= document.getElementById("children"+lookup+"");
   if(child)
   { 
    child.className= "childrenshow"
    isExpanded[e.lookup] =1;
    parentID= document.getElementById("parent"+lookup);
    parentID.className="minus"  
   }
  }
 }
 else
 {
  children= eval(e.hasChild);
  if(children)
  {
   lookup= eval(e.lookup)
   child= document.getElementById("children"+lookup+"");
   if(child)
   { 
    child.className= "children"
    isExpanded[e.lookup] =0;
    parentID= document.getElementById("parent"+lookup);
    parentID.className="plus"   
   }
  }
 }
 cookiedata ="navtree="
 for (i=0;i<LIST_COUNT;i++) {
  cookiedata =cookiedata + "parent" + i +"~"+isExpanded[i]+"|";
 }
 document.cookie = cookiedata +"\n";
 return false;
}

function domouseover () {
 e=event.srcElement;
 while (e.tagName!="TD" && e.tagName!=null) e=e.parentElement;
 e.className="barover";
}

function domouseout () {
 e=event.srcElement;
 while (e.tagName!="TD" && e.tagName!=null) e=e.parentElement;
 e.className="bar";

}
function init(){
 getEs=document.getElementsByTagName("ul");
 for (i=0;i<getEs.length;i++) {
  e = getEs[i];
  if(e.id.substring(0,1)== 'p')
  {
   LIST_COUNT++;
  }
 }
 for (i=0;i<LIST_COUNT;i++)
 {
  isExpanded[i] =0	
  isExpanded[i]= retrieve_field("parent"+i);
  hasChild="children"+i;
  hasChild= document.getElementById(hasChild);
  if(hasChild)
  {  
   hasChild.className= "children"
   if(isExpanded[i] =="1"){
    hasChild.className= "childrenshow";
    parentID= document.getElementById("parent"+i);
    parentID.className="minus"
   }
   else {
    hasChild.className= "children";
    parentID= document.getElementById("parent"+i);
    parentID.className="plus"     
   }
   eval("parent"+i+".hasChild=true");
   eval("parent"+i+".lookup="+i+"");
   eval("parent"+i+".onmousedown=domousedown");
   eval("parent"+i+"l.onmousedown=domousedown");
   eval("parent"+i+"l.onmouseover=function(){this.style.background='#cc0066'}");
   eval("parent"+i+"l.onmouseout=function(){this.style.background=''}");
   eval("parent"+i+"l.onclick=function(){return domousedown();}");
  }
  else {
   eval("parent"+i+".hasChild=false");
   eval("parent"+i+".lookup="+i+"");
   just_a_file= document.getElementById("parent"+i);
   just_a_file.className= "fileonly";
  }
 }
}


