/* Global Variables*/
var hideTimer=0, showTimer=0;
var lastObj=null;


function showLeftSubNav(e,obj) { 
	if (obj == lastObj) {
		clearTimeout(hideTimer);
		hideTimer=0;
	} else if (lastObj != null) {
		hideSM(lastObj);	
	}
   
	showSM(obj);
}

function hideLeftSubNav(e,obj) {
	
	if (window.event) {  /* IE hack*/
		current = obj;
		related = window.event.toElement;
	}
	else {
		current = e.currentTarget;
		related = e.relatedTarget;
	}	
	
	if (current != related && !contains(current, related)) {
		lastObj=obj;
	    hideTimer=setTimeout(function(){hideSM(obj)},100);
    }
	
	
 
}

function showSM(obj) {
	if (typeof obj.style == "undefined") return;
	obj.style.visibility="visible";
	obj.parentNode.className = "currentMenu nav-menu-item"; 	
}

function hideSM(obj) {
	if (typeof obj.style == "undefined") return;
	 
	obj.style.visibility="hidden"; 
	obj.parentNode.className = "nav-menu-item";
	lastObj=null;
}

function showSubheaderMenu() { 

    var checkSubMenu = document.getElementById("subheader-Submenu-container");	
    var subMenu = document.getElementById("subheader-Submenu");

   
    if(checkSubMenu && subMenu) {
       checkSubMenu.className = "subheader-Submenu-active"; 
       subMenu.className = "show-subMenu";   
       }
}

function hideSubheaderMenu() { 

    var checkSubMenu = document.getElementById("subheader-Submenu-container");	
    var subMenu = document.getElementById("subheader-Submenu");
    
    if(checkSubMenu && subMenu) {
	    checkSubMenu.className = "subheader-Submenu-nonactive";  
	    subMenu.className = "hide-subMenu";  
    }
 
}

function contains(a, b) {

  /* Return true if node a contains node b. */
  
	if(b) {
	while (b.parentNode)
		if ((b = b.parentNode) == a)
			return true;
	}    
	
	return false;
}

