﻿menuHover = function() {
		var navRoot = document.getElementById("nav").getElementsByTagName("li");
		for (var i=0; i<navRoot.length; i++) {
		
			navRoot[i].onmouseover=function() {
				this.className+=" menuHover";
				
				this.ID = subNav;
				var navSubRoot = document.getElementById("subNav").getElementsByTagName("li");
                for (var i=0; i<navSubRoot.length; i++)
                {
                    navSubRoot[i].onmouseover=function()
                    {
	                    this.className+=" menuSubHover";       				
                    }
                    navSubRoot[i].onmouseout=function()
                    {
	                    this.className=this.className.replace(new RegExp(" menuSubHover\\b"), "");
                    }
                }	
			}
			navRoot[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" menuHover\\b"), "");
				
			}
		}
		
}
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 */
                   this.lastChild.style.display="block";
                }
                lis[i].onmouseout=function() {   
                   this.lastChild.style.display="none";
                }
            }
        }
    }
}

if (window.attachEvent) window.attachEvent("onload", activateMenu);