
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}


function getElementsByClass(node,searchClass,tag) {
var classElements = new Array();
var els = node.getElementsByTagName(tag); // use "*" for all elements
var elsLen = els.length;
var pattern = new RegExp("\\b"+searchClass+"\\b");
for (i = 0, j = 0; i < elsLen; i++) {
 if ( pattern.test(els[i].className) ) {
 classElements[j] = els[i];
 j++;
 }
}
return classElements;
}

function ieMenu() {
	//navRoot = getElementsByClass(document,'withsubmenu','*');
	navRoot = getElementsByClass(document,'has_submenu','*');
	
	navRoot[0].onmouseover = function() {
		navRoot[0].childNodes[2].className += " over2";
	}
	navRoot[0].onmouseout = function() {
		navRoot[0].childNodes[2].className = navRoot[0].childNodes[2].className.replace(" over2", "");
	}
	
	navRoot[1].onmouseover = function() {
		navRoot[1].childNodes[2].className += " over2";
	}
	navRoot[1].onmouseout = function() {
		navRoot[1].childNodes[2].className = navRoot[1].childNodes[2].className.replace(" over2", "");
	}
	
	navRoot[2].onmouseover = function() {
		navRoot[2].childNodes[2].className += " over2";
	}
	navRoot[2].onmouseout = function() {
		navRoot[2].childNodes[2].className = navRoot[2].childNodes[2].className.replace(" over2", "");
	}
	
	/*
	navRoot[3].onmouseover = function() {
		navRoot[3].childNodes[2].className += " over2";
	}
	navRoot[3].onmouseout = function() {
		navRoot[3].childNodes[2].className = navRoot[3].childNodes[2].className.replace(" over2", "");
	}
	*/
}

startList = function() {
	if (document.all && document.getElementById) {
		
		navRoot = document.getElementById("tier2_nav");
		if (navRoot != null) {
			for (i = 0; i < navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName == "LI") {				
					node.onmouseover = function() {
						this.style.zIndex = 2;
						this.className += " over";
					}
					node.onmouseout = function() {
						this.className = this.className.replace(" over", "");
					}
				}
			}
		}
				
		navRoot = document.getElementById("main_nav");
		if (navRoot != null) {
			for (i = 0; i < navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName == "LI") {
					node.onmouseover = function() {
						this.style.zIndex = 2;
						this.className += " over";
					}
					node.onmouseout = function() {
						this.className = this.className.replace(" over", "");
					}
				}
			}
		}
	}

	if(document.all && document.getElementById) ieMenu();
}
//window.onload = startList;
addLoadEvent(startList);
