
activateMenu = function(nav) {
	//alert(nav);
    /* currentStyle restricts the Javascript to IE only */
	//if (document.all && document.getElementById(nav).currentStyle) {  
		var navroot = document.getElementById(nav);
		//alert(navroot);
		
		var uls = navroot.getElementsByTagName("UL");
		for (var i = 0; i < uls.length; i++) {
			//alert(uls[i].parentNode);
			uls[i].parentNode.onmouseover=function() {		
			   /* display the inner menu */
			   //alert('mouseover');
			   this.getElementsByTagName("ul")[0].style.display="block";
			}
			
			uls[i].parentNode.onmouseout=function() {		
			   /* hide the inner menu */
			   //alert('mouseout');
			   this.getElementsByTagName("ul")[0].style.display="none";
			}
		}
		return;
        /* Get all the list items within the menu */
        var lis=navroot.getElementsByTagName("LI");  
		alert(lis.length);
		for (i=0; i<lis.length; i++) {
			alert(i + ': ' + lis[i].lastChild);
            /* If the LI has another menu level */
            if(lis[i].lastChild.tagName=="UL"){
                /* assign the function to the LI */
             	lis[i].onmouseover=function() {		
                   /* display the inner menu */
				   alert('mouseover');
                   this.lastChild.style.display="block";
      			}
				lis[i].onmouseout=function() {                       
					alert('mouseout');
                    this.lastChild.style.display="none";
				}
            }
		}
	//}
}
window.onload= function(){
    activateMenu('nav'); /* pass in the id of the top level UL */
    activateMenu('vertnav'); 
}

