// JavaScript Document
// enable primary nav menus for IE
function menu() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("navPrimaryUL");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				addOverClass(node);
				for (j=0; j<node.childNodes.length; j++) {
					linode = node.childNodes[j];
					if (linode.nodeName=="UL") {
						for (k=0; k<linode.childNodes.length; k++) {
							ulnode = linode.childNodes[k];
							if (ulnode.nodeName=="LI") {
								addOverClass(ulnode);													   
							}
						}
					}
				}
			}
		}			
	}
} 

// add " over" class to <li>s on mouseover, remove on mouseout
function addOverClass(nodename) {
	nodename.onmouseover=function() {
		this.className+=" over";
	}
	nodename.onmouseout=function() {
		this.className=this.className.replace(" over", "");
	}
}

// Sniff pre v.86 versions of Safari and hide the primary nav menus
function detectSafari() {
	var agt = navigator.userAgent.toLowerCase();
	var appVer = navigator.appVersion.toLowerCase();	
	var is_safari = (agt.indexOf("safari") != -1);
	var build = appVer.substring(appVer.lastIndexOf("/")+1);
	var majorBuild = build.split(".");

	if (is_safari == 1 && majorBuild[0] < 86) {
		//alert("safari major build 85 or less");
		document.write('<style type="text/css">#navPrimary li:hover ul, #navPrimary li li:hover ul { display: none; }</style>');
	}
}
detectSafari();


// Call menu() onload
window.onload = function() {
	menu();
}	
