
//////////topmenu_wide/delayHover.js from top nav. ////////////////////////////////////////////////////////////////////////////////

var delay = 350; /* milli seconds */
function attachHooks() {
    var menu = document.getElementById("nav");
    var menuItems = menu.getElementsByTagName("li");
	currentHover = menuItems[0];
    for (var i = 0; i < menuItems.length; i++) {
        menuItems[i].onmouseover = function () {
		activateMenuWithDelay(this);
		};
        menuItems[i].onmouseout = function () {
		deactivateMenuWithDelay(this);
		
		};
    }
}
function activateMenuWithDelay(ele) {
	if(ele.timer) {
        clearTimeout(ele.timer);
	}
	ele.timer = setTimeout(function(){activateShowMenu(ele)}, delay);
}
function activateShowMenu(ele) {
	var parent = ele;
    parent.className = "showMenu";
}

function deactivateMenu(ele) {
    var parent = ele;
    parent.className = " ";
}

function deactivateMenuWithDelay(ele) {
	if(ele.timer) {
        clearTimeout(ele.timer);
	}
    ele.timer = setTimeout(function(){deactivateMenu(ele)}, delay);
}
function initMenuDelay() {
	attachHooks();
	deactivateMenu();
}
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
	 	window.onload = func;
	} else {
	 	window.onload = function() {
	 	oldonload();
	 	func();
	 	}
	}
}
addLoadEvent(attachHooks);
/////////////////topmenu_wide/delayHover.js end //////////////////////////////////////////////////////////////////////////////////////////


