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;
}

//alert(navigator.userAgent);
if (navigator.userAgent.indexOf("Firefox")!=-1){
	//alert("Firefox");
	isFirefox = true;
}else{
	isFirefox = false;
}

function doOnLoad(){
	if( !isFirefox ){
		window.focus();	
	}
}

function doResize(){
	if( !isFirefox ){
		location = location;
	}
}

loaded = false;

function hide(id){
	if (ns) document.layers[id].visibility = "hide"
	if (ns6){
		var obj = eval("document.getElementById('" + id + "')")
		obj.style.visibility = "hidden"
	}
	else if (ie) document.all[id].style.visibility = "hidden"
}
function show(id){
	if (ns) document.layers[id].visibility = "show"
	if (ns6){
		var obj = eval("document.getElementById('" + id + "')")
		obj.style.visibility = "visible"
	}
	else if (ie) document.all[id].style.visibility = "visible"
}

bOff = new Image; bOff.src = "../images/nav/bOff.gif";
bOn = new Image; bOn.src = "../images/nav/bOn.gif";

nav_01 = new Image; nav_01.src = "../images/nav/nav_01.jpg";
nav_01_over = new Image; nav_01_over.src = "../images/nav/nav_01-over.jpg";
nav_03 = new Image; nav_03.src = "../images/nav/nav_03.jpg";
nav_03_over = new Image; nav_03_over.src = "../images/nav/nav_03-over.jpg";
nav_05 = new Image; nav_05.src = "../images/nav/nav_05.jpg";
nav_05_over = new Image; nav_05_over.src = "../images/nav/nav_05-over.jpg";
nav_07 = new Image; nav_07.src = "../images/nav/nav_07.jpg";
nav_07_over = new Image; nav_07_over.src = "../images/nav/nav_07-over.jpg";
nav_09 = new Image; nav_09.src = "../images/nav/nav_09.jpg";
nav_09_over = new Image; nav_09_over.src = "../images/nav/nav_09-over.jpg";

function swap(theName,theIMG){
	theIMG = eval(theIMG);
	document[theName].src = theIMG.src;
}

function menuItem(displayText,theLink,theWidth,theTarget,image){
	this.displayText= displayText;
	this.theLink	= theLink;
	this.theWidth	= theWidth;
	this.theTarget	= theTarget;
	this.navImage = image;
}

/**/

mainNav = new Array();
	mainNav[0] = new menuItem("Season","../season/season.aspx",126,0,"nav_01");
	mainNav[1] = new menuItem("Visit Us","../visitus/directions.aspx",127,0,"nav_03");
	mainNav[2] = new menuItem("Support","../support/givenow.aspx",128,0,"nav_05");
	mainNav[3] = new menuItem("Education","../education/student.aspx",127,0,"nav_07");
	mainNav[4] = new menuItem("About MRT","../aboutus/mission.aspx",128,0,"nav_09");
subnav0 = new Array();
    subnav0[0] = new menuItem("2010-11 Season","../season/season.aspx", -1, 0,0);
	subnav0[1] = new menuItem("Calendar","../season/calendar.aspx", -1, 0,0);
	subnav0[2] = new menuItem("Box Office/Ticket Info","../season/tickets.aspx", -1, 0,0);
	subnav0[3] = new menuItem("Subscriptions","../season/subscriptions.aspx", -1, 0,0);
	subnav0[4] = new menuItem("Group Sales","../season/groupsales.aspx", -1, 0,0);
	subnav0[5] = new menuItem("Seating Chart","../season/seating.aspx", -1, 0,0);
subnav1 = new Array();
	subnav1[0] = new menuItem("Directions","../visitus/directions.aspx", -1, 0,0);
	subnav1[1] = new menuItem("Area Dining","../visitus/areadining.aspx", -1, 0,0);
	subnav1[2] = new menuItem("Hotels","../visitus/hotels.aspx", -1, 0,0);
	subnav1[3] = new menuItem("Other Destinations","../visitus/otherdestinations.aspx", -1, 0,0);
subnav2 = new Array();
	subnav2[0] = new menuItem("Give Now","../support/givenow.aspx", -1, 0,0);
	subnav2[1] = new menuItem("Individual Support","../support/individual.aspx", -1, 0,0);
	subnav2[2] = new menuItem("Corporate Sponsorship","../support/corporate.aspx", -1, 0,0);
	subnav2[3] = new menuItem("Our Sponsors","../support/oursponsors.aspx", -1, 0,0);
	subnav2[4] = new menuItem("Volunteer","../support/volunteer.aspx", -1, 0,0);	
	subnav2[5] = new menuItem("Playbill","../support/playbill.aspx", -1, 0,0);	
//	subnav2[6] = new menuItem("Educational Partnerships","../education/community.aspx");
subnav3 = new Array();
	subnav3[0] = new menuItem("Student Matinees","../education/student.aspx", -1, 0,0);
	subnav3[1] = new menuItem("YAAP","../education/yaap.aspx", -1, 0,0);
	subnav3[2] = new menuItem("Internships","../education/internships.aspx", -1, 0,0);
	subnav3[3] = new menuItem("Community Partnerships","../education/community.aspx", -1, 0,0);
subnav4 = new Array();
    subnav4[0] = new menuItem("Mission & History","../aboutus/mission.aspx", -1, 0,0);
    subnav4[1] = new menuItem("Leadership","../aboutus/leadership.aspx", -1, 0,0);
	subnav4[2] = new menuItem("Contact Us","../aboutus/contactus.aspx", -1, 0,0);
	subnav4[3] = new menuItem("Our Staff","../aboutus/staff.aspx", -1, 0,0);
	subnav4[4] = new menuItem("Employment","../aboutus/employment.aspx", -1, 0,0);
//	subnav4[5] = new menuItem("Press","../aboutus/press.aspx", -1, 0,0);
	subnav4[5] = new menuItem("Venue Info","../aboutus/venue.aspx", -1, 0,0);
	

/**/

function mainNavWidth(){
	mainWidth = 0;
	for(w = 0; w < mainNav.length; w ++){
		mainWidth += mainNav[w].theWidth;
	}
	return mainWidth;
}

outHTML = "";

function writeNav(){
	outHTML += "<table border='0' bordercolor='blue' cellpadding=0 cellspacing=0 border=0 width='" + mainNavWidth() + "'><tr>";
	for( i = 0; i < mainNav.length; i ++ ){
	objNavImageOver = mainNav[i].navImage + "_over";
	objNavImage = mainNav[i].navImage;
		if( mainNav[i].theTarget > 0 ){
			theTarget = " target=\"" + mainNav[i].displayText.replace(" ", "") + "\"";
		}else{
			theTarget = "";
		}
		if( mainNavHighlight == i ){
			theClass = "navON";
			//NavImage = mainNav[i].navImage + "-over";
			NavImage = mainNav[i].navImage;
			
		}else{
			theClass = "nav";
			NavImage = mainNav[i].navImage;
		}
		if( home ){
			theMouseOver = "doSubs(" + i + ");";
			theMouseOut = ""; //"doSubs(-1);";
		}else{
			theMouseOver = "dropMenu.showMenu('" + mainNav[i].displayText.replace(" ","") + "');";
			theMouseOut = "dropMenu.hideMenu('" + mainNav[i].displayText.replace(" ","") + "');";
		}
		if(NavImage=="nav_07" || NavImage=="nav_09"){
		    rowspan=1;
		}
		else{
		    rowspan=2;
		}
		

		outHTML += "<td rowspan=" + rowspan + " width=" + mainNav[i].theWidth + " class=\"" + theClass + "\" id=\"theBase" + i + "\"><ilayer name=\"theBaseNS\"><layer>";
		outHTML += "<a href=\"" + mainNav[i].theLink + "\" " + theTarget + " onMouseOver=\"swap('i" + i + "','"+objNavImageOver+"');" + theMouseOver + "\" onMouseOut=\"swap('i" + i + "','" + objNavImage + "');" + theMouseOut + "\"><img src=\"../images/nav/" + NavImage + ".jpg\" align=\"absmiddle\" name=\"i" + i + "\" border=0></a>"
		
		outHTML += "</layer></ilayer></td>"; 
		/*Nav Hack*/

	}
	outHTML += "<td rowspan='2' align='right'><img src='../images/nav/nav_10.jpg' width='313' height='50' alt='' /></td></tr></table>";
	document.write(outHTML);
}
function subNavTitle(){
	document.write(mainNav[mainNavHighlight].displayText);
}

function doSubs(focus){
	show("bigHide");
	for( n = 0; n < mainNav.length; n ++ ){
		if( n == focus ){
			show("subNav" + n);
		}else{
			hide("subNav" + n);
		}
	}
	if( focus == -1 ){
		hide("bigHide");
	}
}

function findPosX(obj){
	var curleft = 0;
	if (document.getElementById || document.all){
		while (obj.offsetParent){
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
		//alert(curleft);
		return curleft;
	}
}
function findPosY(obj){
	var curtop = 0;
	if (document.getElementById || document.all){
		while (obj.offsetParent){
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
		return curtop;
	}else{
		curtop += obj.y;
		return curtop;
	}
}
theWidth = 145;
theTop = 139;
outLayersHTML = "";
function writeMenus(){
	for( k = 0; k < mainNav.length; k ++ ){
		nameID = mainNav[k].displayText.replace(" ","");
		if(ie){
			theLeft = findPosX(document.all("theBase" + k));
		}else if(ns6){
			theLeft = findPosX(document.getElementById("theBase" + k));
		}else if(ns){
			theLeft = document.layers["theBaseNS"].pageX;
		}
		theLeft += 12;
		if(isFirefox){
			theLeft-=12;
		}
		outLayersHTML += "<script language=\"javascript\">new dropMenu('" + nameID + "', 'down', " + theLeft + ", " + theTop + ", " + theWidth + ", 180)</script>";
		outLayersHTML += "<div id='" + nameID + "Container'>";
			outLayersHTML += "<div id='" + nameID + "Content' class='menu'>";
				outLayersHTML += "<div class='options'>";
		curELE = eval("subnav" + k);
		for( n = 0; n < curELE.length; n ++ ){
			if( curELE[n].theTarget!=null && curELE[n].theTarget!=0 ){
				theTarget = " target=\"" + curELE[n].displayText.replace(" ", "") + "\"";
			}else{
				theTarget = "";
			}
			if( mainNavHighlight == k && subNavHighlight == n ){
				theSQ = "bOn";
			}else{
				theSQ = "bOff";
			}
					outLayersHTML += "<a href=\"" + curELE[n].theLink + "\" " + theTarget + " onMouseOver=\"swap('s" + k + n + "','bOn');\" onMouseOut=\"swap('s" + k + n + "','" + theSQ + "');\"><img src=\"../images/nav/" + theSQ + ".gif\" width=13 height=11 align=\"absmiddle\" name=\"s" + k + n + "\" border=0>" + curELE[n].displayText + "</a>";
		}
			if( curELE.length > 0 ){
					outLayersHTML += "<table cellpadding=0 cellspacing=0 border=0 width=" + theWidth + "><tr><td width=\"" + theWidth + "><img src=\"../images/spacer.gif\" width=1 height=5></td></tr></table>";
			}
				outLayersHTML += "</div>";
				/*if( curELE.length > 0 ){
					outLayersHTML += "<table cellpadding=0 cellspacing=0 border=0 width=" + theWidth + "><tr><td width=9><img src=\"../images/nav/corner.gif\" width=9 height=10></td><td width=\"" + (theWidth - 9) + "\" background=\"../images/nav/botRowBG.gif\"><img src=\"../images/spacer.gif\" width=1 height=10></td></tr></table>";
				}*/
			outLayersHTML += "</div>";
		outLayersHTML += "</div>";
	}
	//alert(outLayersHTML);
	document.write(outLayersHTML);
}

