//Not that elegant.  Javascript is not my bag.  Feel free to suggest improvements...
//Mick Sear, eCreate, 2005


var parents = new Array();

function nav(){
	
   if (document.getElementById) {
      root = document.getElementById("menuRoot");
      
      //alert(root);
      for(i=1;i<menuCount;i++){//Don't hide the root (0) element, so start from 1
         el = document.getElementById("menu" + i);
         set(el);
      }
      
      //alert("Current: " + Current);
      var CurrentNode = document.getElementById(Current);
      showParents(CurrentNode);
   }
} 

function set(setnode){
   if (setnode.className != "show") {
      setnode.className="hide";
      setnode.onclick=function(e) {

         if (this.className=="show") {
            this.className="hide";                           
         } else {
            
            this.className="show";
         }

         showParents(this);
      }      
   }
}
   
function showParents(node){

   p = node.parentNode.parentNode;   
   if (p){
   
      if (p.id == "menuRoot"){
         return;
      }
      
      if (p.nodeName == "LI"){

         p.className="";
      } 
      
      showParents(p);
   }
}

/*To debug, add <div id='debug'></div> in your HTML and then debug(somevar) in this file.*/
function debug(msg){
   d = document.getElementById("debug");
   d.innerHTML += "<br />"+msg;  
}