<!-- $Header: /WebSites/nlgsite/scripts/navFinal.js 21    6/06/11 4:32p Ehermance $ -->

//Get Browser to refer to later
ns = (document.layers)? true:false
ie = (document.all)? true:false
ns6 = (navigator.appName == "Netscape" && document.getElementById)? true:false
winIE5 = false;
var browserString = navigator.appVersion;
if (navigator.userAgent.indexOf("Win") > -1 && navigator.appName == "Microsoft Internet Explorer"){
	if (parseInt(browserString.charAt(22)) < 6){
		winIE5 = true;
	}
}
macIE = false;
macNS = false;
var browserString = navigator.appVersion;
if (navigator.userAgent.indexOf("Mac") > -1 && navigator.appName == "Microsoft Internet Explorer"){
	macIE = true;
}else if(navigator.userAgent.indexOf("Mac") > -1 && navigator.appName != "Microsoft Internet Explorer"){
	macNS = true;
}

//get images to refer to later
arrowOff = new Image; arrowOff.src = "images/arrowOffTrans.gif";
arrowOn = new Image; arrowOn.src = "images/arrowOnTrans.gif";

//This function can pop up a spawn window when called
function openWin(page,name,width,height,scroll,resize){
window.open(page,name,"toolbar=0,location=0,status=0,menubar=0,scrollbars=" + scroll + ",resizable=" + resize + ",top=0,left=0,width=" + width + ",height=" + height)
}


//Declare variables which contain the value of the proper hexidecimal colos which will be referred to later
var itemcoloroff = "#7D95A3";
var itemcoloron = "#000000";

//Function which control the mouse events for the navigation
function togglemenu(menuID)  {
	var themenu = "dropdown" + menuID;
	if (isDisplayed(themenu)  == "block"){
		hidemenu(menuID);
	}else{
		showmenu(menuID);
	}
}
function showmenu(menuID){
	var themenu = "dropdown" + menuID;
	setCursor("pointer");
	setDisplay(themenu,"block");
	var menucontroller = getObj("menucontrol" + menuID);
	//menucontroller.firstChild.firstChild.data = "-";
	eval("document.arrowImage" + menuID + ".src=arrowOn.src");
}
function hidemenu(menuID){
	var themenu = "dropdown" + menuID;
	setCursor("auto");
	setDisplay(themenu,"none");
	var menucontroller = getObj("menucontrol" + menuID);
	//menucontroller.firstChild.firstChild.data = "+";
	eval("document.arrowImage" + menuID + ".src=arrowOff.src");
}
function menuFX(thisobj,theevent){
	if (theevent == "over"){
		setColor(thisobj,itemcoloron);
		setCursor("pointer");
	}else{
		setColor(thisobj,itemcoloroff);
		setCursor("auto");
	}
}
function goPage(thisobj,menunum,itemnum,goURL){
	menuFX(thisobj,"out");
	//hidemenu(1);
	//hidemenu(2);
	//window.location.href = eval("menu" + menunum + "url[" + itemnum + "]");
	window.location.href = goURL;
}
function doNav(ele, theColor){
	ele.style.backgroundColor = theColor;
}

//This function is used for building the multi-dimensional arrays below
function menuItem(displayText,hasSub,paramURL){
	this.displayText = displayText;
	this.hasSub = hasSub;
	this.paramURL = paramURL;
}


//These arrays contain the particulars of the navigation
//The first param is the text displayed on the navigation button, example "Home"
//The second param is 0 if the button does not have a sub-menu, and 1 if it does
//The third param is the url of the nav item. If it has a sub-menu, then it doesn't have a url and vice-versa
mainNav = new Array();
	mainNav[0] = new menuItem("Home", 0, "default.html");//script_name + "?section=home"
	mainNav[1] = new menuItem("About WTH", 1, "history.html");
	mainNav[2] = new menuItem("WTH Careers", 1, "work.html");
	mainNav[3] = new menuItem("Contact WTH", 0, "contact.html");//script_name + "?section=contact"
	mainNav[4] = new menuItem("Press Releases", 0, "pressRelease.html");
sub0 = new Array();
sub1 = new Array();
	sub1[0] = new menuItem("Our Story", 0, "history.html");//script_name + "?section=about&page=aboutOverview"
	sub1[1] = new menuItem("Executive Team", 0, "execTeam.html");//script_name + "?section=about&page=execTeam"
	sub1[2] = new menuItem("Brands", 0, "brandList.html");//script_name + "?section=about&page=brand"
sub2 = new Array();
	sub2[0] = new menuItem("Jobs @ WTH", 0, "work.html");//script_name + "?section=work&page=workOverview"
	sub2[1] = new menuItem("Life @ WTH", 0, "life.html");//script_name + "?section=life&page=lifeOverview"
	sub2[2] = new menuItem("Virtual Careers", 0, "virtualCareers.html");
	sub2[3] = new menuItem("Search Jobs", 0, "searchJobs.asp");
//sub3 = new Array();
	//sub3[0] = new menuItem("Press Releases", 0, "pressRelease.html");//script_name + "?section=press&page=pressReleases"
	//sub3[1] = new menuItem("WTH In The News", 0, "news.html");//script_name + "?section=press&page=news"
sub3 = new Array();

outHTML = "";
blockColor = "#015295";


//functions which write the navigation to the page
function doHeader(blockColor, cellColor, cellColorOver, cellColorOut, count){
	outHTML += "<table cellpadding=0 cellspacing=0 border=0 width=164>";
	outHTML += "<tr><td width=10 bgcolor=\"" + blockColor + "\"><img src=\"images/arrowOff.gif\" width=10 height=28 name=\"arrowImage" + count + "\"></td>"
	outHTML += "<td width=1 bgcolor=\"#ffffff\"><img src=\"images/clear.gif\" width=1 height=1></td>"
	outHTML += "<td width=153 bgcolor=\"" + cellColor + "\" class=\"nav\" onMouseOver=\"doNav(this,'" + cellColorOver + "');\"\ onMouseOut=\"doNav(this,'" + cellColorOut + "');\"";
}

function writeNav(){
	for(i = 0; i < mainNav.length; i ++){
		if(ns){ //|| winIE5
			if(i == 0){
				outHTML += "<div id=\"mud\" style=\"position:absolute;left:0px;top:0px;visibility:hidden;z-index:0\"></div>"
			}
		}else{
			if(highLight == i){
				blockColor = "#ffffff"; //"#439639";
				cellColor = "#ffffff"; //"#000000";
				cellColorOver = cellColor;
				subClass = "dropdownON";
				highLightSection = true;
			}else{
				blockColor = "#ffffff"; //"#015295";
				cellColor = "#ffffff";//"#666666";
				cellColorOver = "#ffffff"; //"#d3d3d3"; //"#514B4B";
				subClass = "dropdown";
				highLightSection = false;
			}
			if(ns6){
				theLine = "";
			}else{
				theLine = "<img src=\"images/clear.gif\" width=1 height=1>";
			}
			cellColorOut = cellColor;
			if(mainNav[i].hasSub == 0){
				doHeader(blockColor, cellColor, cellColorOver, cellColorOut, i);
				outHTML += " onClick=\"location='" + mainNav[i].paramURL + "';\"><a href=\"" + mainNav[i].paramURL + "\"><img src=\"images/clear.gif\" width=8 height=1 align=\"absmiddle\" border=0>" + mainNav[i].displayText + "</a></td></tr><tr><td colspan=3 bgcolor=\"#ffffff\">" + theLine + "</td></tr></table>";
			}else{
				doHeader(blockColor, cellColor, cellColorOver, cellColorOut, i);
				outHTML += "><div onmouseover=\"setCursor('pointer');\" onmouseout=\"setCursor('auto');\" onclick=\"togglemenu(" + i + ");\"><img src=\"images/clear.gif\" width=5 height=1 align=\"absmiddle\" border=0><!--span id=\"menucontrol" + i + "\" class=\"menucontrol\" ><sup>+</sup></span--> <span id=\"menutitle" + i + "\"><a href=\"" + mainNav[i].paramURL + "\">" + mainNav[i].displayText + "</a></span></div></td></tr><tr><td colspan=3 bgcolor=\"#ffffff\">" + theLine + "</td></tr></table>";
				currSub = eval("sub" + i);
				outHTML += "<div id=\"dropdown" + i + "\" class=\"" + subClass + "\">"
				for(j = 0; j < currSub.length; j ++){
					if(highLightSection && subHighLight == j){
						imgSquare = "bullet_on";
					}else{
						imgSquare = "bullet_off";
					}
					outHTML += "<div class=\"menuitem\"><table cellpadding=0 cellspacing=0 border=0 width=164>";
					outHTML += "<tr bgcolor=\"#ffffff\"><td width=14><img src=\"images/clear.gif\" width=14 height=20></td>";
					outHTML += "<td width=150 onmouseover=\"menuFX(this,'over');\" onmouseout=\"menuFX(this,'out');\" onclick=\"goPage(this,1,1,'" + currSub[j].paramURL + "');\" style=\"font-size:11px;color:7D95A3;\"><img src=\"images/" + imgSquare + ".gif\" width=15 height=11 align=\"absmiddle\" border=0>" + currSub[j].displayText + "</td></tr><tr><td colspan=2 bgcolor=\"#ffffff\">" + theLine + "</td></tr></table></div>";
				}
				outHTML += "</div>";
			}
		}
	}
	document.write(outHTML);
}
