activateMenu = function(nav) {

/* currentStyle restricts the Javascript to IE only */
	if (document.all &&
 document.getElementById(nav).currentStyle) {  
        var navroot = document.getElementById(nav);
        
        /* Get all the list items within the menu */

        var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {
        
           /* 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 */
				   /*if (this.parentNode.parentNode.tagName != "DIV")*/ this.style.background = "#666666";
                   this.lastChild.style.display="block";
                }
                lis[i].onmouseout=function() {   
					if (this.parentNode.parentNode.tagName != "DIV") this.style.background="#990000";
                	else if (this.nextSibling==null) this.style.background = this.prevSibling.style.background
					else this.style.background = this.nextSibling.style.background
					
					this.lastChild.style.display="none";
                }
				lis[i].onclick=function() {
					if (this.parentNode.parentNode.tagName != "DIV") this.style.background="#990000";
                	else if (this.nextSibling==null) this.style.background = this.prevSibling.style.background
					else this.style.background = this.nextSibling.style.background
					
					this.lastChild.style.display="none";
				}
            }
        }
    }
}
window.onload= function(){
    activateMenu('nav');  
}