function hiliteMenu() {
	var navSection = document.getElementById("sideNav");
	
	var links = navSection.getElementsByTagName("a");
	
	var docLoc = document.location.href.toLowerCase();
	
	var hotLink;	
	
	for (var i=0; i < links.length; i++) {
      
        if (links[i].href.toLowerCase() == docLoc) {
               
            links[i].className = 'active';
        
            if ( links[i].parentNode != null ) { 
        
                // Executing recursive method that will 'bubble-up' and activate any parent li and ul elements                           
                activate(links[i].parentNode); 
                
                // Activating UL child nodes of this node
                if ( links[i].parentNode.hasChildNodes() ) {                                
                
                    for ( k = 0; k < links[i].parentNode.childNodes.length; k++ ) {                    
                        if ( links[i].parentNode.childNodes[k].tagName == 'UL' ) { links[i].parentNode.childNodes[k].className = 'active'; }                    
                    }                
                    
                } 
            }           
        }
   }
   return;        
}


function activate(node) {   

    if (node.tagName == 'LI') {
    
        node.className = 'active';
        
        if (node.parentNode != null) {
            activate(node.parentNode);
        }
    
    }
    
    else if (node.tagName == 'UL') {
    
        node.className = 'active';
        
        if (node.parentNode != null) {
            activate(node.parentNode);
        }
        
    }
    
    else {
        return;
    }                

}

if(window.addEventListener) {
	window.addEventListener("load",hiliteMenu,false);
} else if( window.attachEvent ) {
	window.attachEvent("onload",hiliteMenu);
}