// JavaScript Document
var strCurMenuID = "";
function initMenus() {
	var arrAnchors = document.getElementById("main-navigation").getElementsByTagName("a");
	for (var i=0; i<arrAnchors.length; i++) {
		if (arrAnchors[i].className.indexOf("subnavlink") != -1) {
			arrAnchors[i].onmouseover = function() {
				if (strCurMenuID != this.id) {
					if (strCurMenuID != "") {
						document.getElementById(strCurMenuID).className = document.getElementById(strCurMenuID).className.replace(" active","");
						document.getElementById(strCurMenuID + "sub").style.display = "none";
					}
					strCurMenuID = this.id;
					this.className += " active";
					document.getElementById(strCurMenuID + "sub").style.display = "block";
				}
				clearTimeout(itvCloseMenu);
			}
			arrAnchors[i].onmouseout = function() {
				itvCloseMenu = setTimeout(hideMenus,intTimeout);
			}
			initSubMenus(arrAnchors[i].id + "sub");
		} else {
			arrAnchors[i].onmouseover = hideMenus;
		}
	}
}
var itvCloseMenu = 0;
var intTimeout = 200;
function initSubMenus(strSubMenuID) {
	var arrSubAnchors = document.getElementById(strSubMenuID).getElementsByTagName("a");
	for (var i=0; i<arrSubAnchors.length; i++) {
		arrSubAnchors[i].onmouseover = function() {
			clearTimeout(itvCloseMenu);
		}
		arrSubAnchors[i].onmouseout = function() {
			itvCloseMenu = setTimeout(hideMenus,intTimeout);
		}
	}
}
function hideMenus() {
	if (strCurMenuID != "") {
		document.getElementById(strCurMenuID).className = document.getElementById(strCurMenuID).className.replace(" active","");
		document.getElementById(strCurMenuID + "sub").style.display = "none";
		strCurMenuID = "";
	}
}
initMenus();