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;
}
function hide(id){
	//alert(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"
}
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;
	}
}

function doMainNav(theIndex,whichRoll){
	for(i = 1; i <= (mainNavs.length - 1); i ++){
		if(i == theIndex){
			//swap("arrow" + i,"arrow" + whichRoll);
			if(ns6){
				var obj = eval("document.getElementById('butID" + i + "')")
				obj.style.backgroundImage = "url('../images/navbg.gif')";
				obj.style.color = '79ae5b';
			}else if(ie){
				if(!macIE){
					document.all["butID" + i].style.backgroundImage = "url('../images/navbg.gif')";
					document.all["navID" + i].style.color = '79ae5b';
				}
				document.all["navID" + i].style.color = '79ae5b';
			}
			show("menu" + i);
			show("bigHide");
			show("bigHide2");
			for(m = 1; m <= totalSubSubs; m ++){
				hide("menuSub" + m);
			}
		}else{
			//swap("arrow" + i,"arrowOff");
			if(ns6){
				var obj = eval("document.getElementById('butID" + i + "')")
				obj.style.backgroundImage = "url('../images/navbg.gif')";
				obj.style.color = 'FFFFFF';
			}else if(ie){
				if(!macIE){
					document.all["butID" + i].style.backgroundImage = "url('../images/navbg.gif')";
				}
				document.all["navID" + i].style.color = '79ae5b';
			}
			hide("menu" + i);
		}
	}
	//swap("arrow" + theIndex,"arrow" + whichRoll);
	if(theIndex == -1){
		for(m = 1; m <= totalSubSubs; m ++){
			hide("menuSub" + m);
		}
		doSubNav(-1, 1, -1, -1);
		for(m = 1; m <= totalSubSubSubs; m ++){
			hide("menuSubSub" + m);
		}
		doSubSubNav(-1, 1, -1, -1);
		hide("bigHide");
		hide("bigHide2");
	}
}

function mainNavOBJ(theWidth, displayText, theLink){
	this.theWidth		= theWidth;
	this.displayText	= displayText;
	this.theLink		= theLink;
}

masterTop = 61;


mainNavs = new Array();
	mainNavs[1] = new mainNavOBJ(0, "2011 REGATTA", "../2011HOCR/race_weekend.asp");
	mainNavs[2] = new mainNavOBJ(0, "COMPETITORS", "../competitors/default.asp");
	mainNavs[3] = new mainNavOBJ(0, "GET INVOLVED", "../getting_involved/default.asp");
	mainNavs[4] = new mainNavOBJ(0, "SPONSORSHIP", "../sponsorship/default.asp");
	mainNavs[5] = new mainNavOBJ(0, "ABOUT HOCR", "../about/history.asp");
	mainNavs[6] = new mainNavOBJ(0, "GIVING", "../giving/endowment.asp");
	mainNavs[7] = new mainNavOBJ(0, "SHOP", "../shop/ppb.asp");
	


function writeMainNav(){
	outMainHTML = "";
	outMainHTML += "<table cellpadding=0 cellspacing=0 border=0 width=569 bgcolor=\"518a2a\"><tr height=10>";
	for(i = 1; i <= (mainNavs.length - 1); i ++){
		outMainHTML += "<td width=0 id=\"navID" + i + "\"></td>";
		outMainHTML += "<td width=" + mainNavs[i].theWidth + " class=\"nav\" align=\"center\" onMouseOver=\"doMainNav(" + i + ");\" id=\"butID" + i + "\" onClick=\"location='" + mainNavs[i].theLink + "';\"> &nbsp; " + mainNavs[i].displayText + "</td>";
		outMainHTML += "<td width=1 bgcolor=\"518a2a\"><img src=\"../images/spacer.gif\" width=1 height=1></td>"
	}
	outMainHTML += "<td width=1 bgcolor=\"518a2a\"><img src=\"../images/spacer.gif\" width=1 height=1></td></tr></table>";
	//alert(outMainHTML);
	document.write(outMainHTML);
}

function writeMainNavNoDropDown(){
	outMainHTML = "";
	outMainHTML += "<table cellpadding=0 cellspacing=0 border=0 width=569 bgcolor=\"518a2a\"><tr height=10>";
	for(i = 1; i <= (mainNavs.length - 1); i ++){
		outMainHTML += "<td width=0 id=\"navID" + i + "\"></td>";
		outMainHTML += "<td width=" + mainNavs[i].theWidth + " class=\"nav\" align=\"center\" id=\"butID" + i + "\" onClick=\"location='" + mainNavs[i].theLink + "';\"> &nbsp; " + mainNavs[i].displayText + "</td>";
		outMainHTML += "<td width=1 bgcolor=\"518a2a\"><img src=\"../images/spacer.gif\" width=1 height=1></td>"
	}
	outMainHTML += "<td width=1 bgcolor=\"518a2a\"><img src=\"../images/spacer.gif\" width=1 height=1></td></tr></table>";
	//alert(outMainHTML);
	document.write(outMainHTML);
}

function doSubNav(ele, state, subIndex, rowIndex){
	if(state > 0){
		//alert(ele.id);
		//ele.style.backgroundColor = '778998';
		//ele.style.color = '000000';
		for(m = 1; m < rowCount; m ++){
			if(m == rowIndex){
				if(ns6){
					var obj = eval("document.getElementById('row" + m + "')")
					obj.style.backgroundColor = '518a2a';
					obj.style.color = '79ae5b';
				}else if(ie){
					if(!macIE){
						document.all["row" + m].style.backgroundColor = '518a2a';
					}
					document.all["row" + m].style.color = '79ae5b';
				}
			}else{
				if(ns6){
					var obj = eval("document.getElementById('row" + m + "')")
					obj.style.backgroundColor = '518a2a';
					obj.style.color = 'ffffff';
				}else if(ie){
					if(!macIE){
						document.all["row" + m].style.backgroundColor = '518a2a';
					}
					document.all["row" + m].style.color = 'ffffff';
				}
			}
		}
		for(k = 1; k <= totalSubSubs; k ++){
			if(k == subIndex){
				show("menuSub" + k);
			}else{
				hide("menuSub" + k);
			}
		}
		for(k = 1; k <= totalSubSubSubs; k ++){
			hide("menuSubSub" + k);
		}
	}/*else{
		ele.style.backgroundColor = '19344C';
		ele.style.color = 'ffffff';
	}*/
}
function doSubSubNav(ele, state, subIndex, rowIndex){
	if(state > 0){
		//ele.style.backgroundColor = '2E6FAF';
		//ele.style.color = 'ffffff';
		//alert(rowIndex);
		for(b = 1; b < rowSubCount; b ++){
			if(b == rowIndex){
				if(ns6){
					var obj = eval("document.getElementById('rowSub" + b + "')")
					obj.style.backgroundColor = '518a2a';
					obj.style.color = 'ffffff';
				}else if(ie){
					if(!macIE){
						document.all["rowSub" + b].style.backgroundColor = '518a2a';
					}
					document.all["rowSub" + b].style.color = 'ffffff';
				}
			}else{
				if(ns6){
					var obj = eval("document.getElementById('rowSub" + b + "')")
					obj.style.backgroundColor = '518a2a';
					obj.style.color = '000000';
				}else if(ie){
					if(!macIE){
						document.all["rowSub" + b].style.backgroundColor = '518a2a';
					}
					document.all["rowSub" + b].style.color = '000000';
				}
			}
		}
		for(k = 1; k <= totalSubSubSubs; k ++){
			if(k == subIndex){
				show("menuSubSub" + k);
			}else{
				hide("menuSubSub" + k);
			}
		}
	}/*else{
		ele.style.backgroundColor = '778998';
		ele.style.color = '000000';
	}*/
}
function menuItem(displayText,goLink,hasSub,subIndex,topPos,leftPos,newWin){
	this.displayText = displayText;
	this.goLink = goLink;
	this.hasSub = hasSub;
	this.subIndex = subIndex;
	this.topPos = topPos;
	this.leftPos = leftPos;
	this.newWin = newWin;
}
sub1 = new Array();
	sub1[0] = new menuItem("RACE WEEKEND","../2011HOCR/race_weekend.asp",-1,-1,-1,-1,0);
	sub1[1] = new menuItem("2011 EVENT SCHEDULE","../competitors/ScheduleDraw11.asp",-1,-1,-1,-1,0);
	sub1[2] = new menuItem("RESULTS","../results/results_static.asp",-1,-1,-1,-1,0);
	sub1[3] = new menuItem("MEDIA","../2011HOCR/media.asp",-1,-1,-1,-1,0);
	//sub1[2] = new menuItem("ROWER HIGHLIGHTS","../2009HOCR/rower_highlights.asp",-1,-1,-1,-1,0);
	//sub1[3] = new menuItem("ROW-A-PALOOZA","../2008HOCR/rowapalooza.asp",-1,-1,-1,-1,0);
	sub1[4] = new menuItem("GETTING AROUND","../2011HOCR/getting_around.asp",-1,-1,-1,-1,0);
	
	sub1[5] = new menuItem("HOTELS","../2011HOCR/hotels.asp",-1,-1,-1,-1,0);
	sub1[6] = new menuItem("RESTAURANTS","../2011HOCR/restaurants.asp",-1,-1,-1,-1,0);
	sub1[7] = new menuItem("REUNION VILLAGE","../2011HOCR/rv.asp",-1,-1,-1,-1,0);
	sub1[8] = new menuItem("ELIOT BRIDGE ENCLOSURE","../2011HOCR/EBE.asp",-1,-1,-1,-1,0);

sub2 = new Array();
	sub2[0] = new menuItem("APPLICATIONS & ENTRY RULES", "../competitors/default.asp",-1,-1,-1,-1,0);
	sub2[1] = new menuItem("2011 EVENT SCHEDULE", "../competitors/ScheduleDraw11.asp",-1,-1,-1,-1,0);
	//sub2[2] = new menuItem("FREQUENTLY ASKED QUESTIONS", "../competitors/faq.asp",-1,-1,-1,-1,0);
	sub2[2] = new menuItem("REGISTRATION/ CHECK-IN", "../competitors/check_in.asp",-1,-1,-1,-1,0);
	sub2[3] = new menuItem("RACING ON THE CHARLES", "../competitors/race_the_course.asp",-1,-1,-1,-1,0);
	sub2[4] = new menuItem("CHARITY PROGRAM", "../competitors/charity.asp",-1,-1,-1,-1,0);
	sub2[5] = new menuItem("DIRECTORS' CHALLENGE", "../competitors/directorschallenge.asp",-1,-1,-1,-1,0);
	sub2[6] = new menuItem("MAPS", "../competitors/maps.asp",-1,-1,-1,-1,0);
	sub2[7] = new menuItem("PARKING AND LAUNCHING", "../competitors/boats.asp",-1,-1,-1,-1,0);	
sub2[8] = new menuItem("ADAPTIVE EVENT","../competitors/adaptive.asp",-1,-1,-1,-1,0);
sub2[9] = new menuItem("COXSWAIN VIDEO","../competitors/coxswain_clinic.asp",-1,-1,-1,-1,0);


<!--Google Analytics-->
sub3 = new Array();
	sub3[0] = new menuItem("VOLUNTEERS","../getting_involved/volunteering.asp",-1,-1,-1,-1,0);
	sub3[1] = new menuItem("PULL FOR A CURE","../getting_involved/Pull_For_A_Cure.asp",-1,-1,-1,-1,0);
	sub3[2] = new menuItem("RACE COMMITTEE","../getting_involved/Race_Committee.asp",-1,-1,-1,-1,1);
	sub3[3] = new menuItem("EXHIBITORS & VENDORS","../getting_involved/exhibitors.asp",-1,-1,-1,-1,0);
	
	sub3[4] = new menuItem("BOATBUILDERS","../getting_involved/boat_builders.asp",-1,-1,-1,-1,0);



sub4 = new Array();
	sub4[0] = new menuItem("EVENT OVERVIEW","../sponsorship/default.asp",-1,-1,-1,-1,0);
	//sub4[1] = new menuItem("SPONSORSHIP VS. ADVERTISING","../sponsorship/svsa.asp",-1,-1,-1,-1,0);
	sub4[1] = new menuItem("SPONSORSHIP OPPORTUNITIES","../sponsorship/benefits.asp",-1,-1,-1,-1,0);
	sub4[2] = new menuItem("2011 REGATTA SPONSORS","../sponsorship/RegattaSponsors.asp",-1,-1,-1,-1,0);
	sub4[3] = new menuItem("CONTACT INFORMATION","../sponsorship/contact.asp",-1,-1,-1,-1,0);
	//sub4[4] = new menuItem("SPONSORSHIP PROMOTIONS","../sponsorship/promo.asp",-1,-1,-1,-1,0);
sub5 = new Array();
	sub5[0] = new menuItem("REGATTA HISTORY","../about/history.asp",-1,-1,-1,-1,0);
	//sub5[1] = new menuItem("REGATTA SPONSORS","../about/sponsors.asp",-1,-1,-1,-1,0);
	sub5[1] = new menuItem("CHARITY PROGRAMS","../competitors/charity.asp",-1,-1,-1,-1,0);
	sub5[2] = new menuItem("CAMBRIDGE BOAT CLUB","../about/cboat_club.asp",-1,-1,-1,-1,0);
	sub5[3] = new menuItem("BOARD OF DIRECTORS","../about/board.asp",-1,-1,-1,-1,0);
	sub5[4] = new menuItem("ADMINISTRATION","../about/admin.asp",-1,-1,-1,-1,0);
	sub5[5] = new menuItem("CONTACT US","../contact/default.asp",-1,-1,-1,-1,0);
   	sub5[6] = new menuItem("PHOTO GALLERY","../about/PhotoGallery.asp",-1,-1,-1,-1,0);

sub6 = new Array();
	sub6[0] = new menuItem("ENDOWMENT","../giving/endowment.asp",-1,-1,-1,-1,0);
	sub6[1] = new menuItem("CHARITY PROGRAM","../competitors/charity.asp",-1,-1,-1,-1,0);

sub7 = new Array();
	sub7[0] = new menuItem("BANNERS, POSTERS, PROGRAMS","../shop/ppb.asp",-1,-1,-1,-1,0);
	sub7[1] = new menuItem("PHOTOS","../shop/photos.asp",-1,-1,-1,-1,0);
	sub7[2] = new menuItem("ONLINE STORE","http://regattawear.com/hocr.html",-1,-1,-1,-1,1);
		sub7[3] = new menuItem("DVD STORE","../2011HOCR/DVDSTORE.asp",-1,-1,-1,-1,1);
	sub7[4] = new menuItem("FAN BANNER","../shop/fanbanner.asp",-1,-1,-1,-1,1);
	//sub7[3] = new menuItem("ONLINE STORE","http://www.amerasport.com/hocr/",-1,-1,-1,-1,1);

totalSubSubs = 0;
subsub1 = new Array();

totalSubSubSubs = 0;
subsubsub1 = new Array();


rowCount = 1;
rowSubCount = 1;
function writeLayers(){
	outHTML = "";
	menuWith = 150;//120;
	if(ns){
		outHTML += "<div id=\"mud\" style=\"position:absolute;left:0px;top:0px;visibility:hidden;z-index:0\"></div>"
	}
	for(j = 1; j <= (mainNavs.length - 1); j ++){
		currentMenu = eval("sub" + j);
		theLength = currentMenu.length;
		n = j;
		//alert(n);
		if(ie){
			anchorX = findPosX(document.all("navID" + n));
			//theClass = "navSub";
		}else if(ns6){
			anchorX = findPosX(document.getElementById("navID" + n));
			//theClass = "navSub";
		}else if(ns){
			anchorX = document.layers["navID" + n].pageX;
			//theClass = "navSubNS4";
		}
		if( j == 5 ){
			anchorX -= 15;
		}
		if( j == 6 ){
			anchorX -= 103;
		}
		if( j == 7 ){
			anchorX -= 155;
		}
		outHTML += "<div id=\"menu" + j + "\" style=\"position:absolute; top:" + masterTop + "px; left:" + anchorX + "px; visibility:hidden; z-index:100;\">";
		if(theLength > 0){
			//outHTML += "<table cellpadding=0 cellspacing=0 border=0 width=" + (mainNavs[j].theWidth + 25) + ">";
			outHTML += "<table cellpadding=0 cellspacing=0 border=0 width=200>";
			for(z = 0; z < theLength; z ++){
				if(ns){
					theLink = "<a href=\"" + currentMenu[z].goLink + "\">" + currentMenu[z].displayText + "</a>";
					theClass = "subNavNS";
				}else{
					theLink = currentMenu[z].displayText;
					theClass = "subNav";
					if( currentMenu[z].newWin == 1 ){
						theOnClick = "window.open('" + currentMenu[z].goLink + "')";
					}else{
						theOnClick = "parent.location='" + currentMenu[z].goLink + "'";
					}
				}
				if(currentMenu[z].hasSub != null){
					//theArrow = "<img src=\"../images/spacer.gif\" width=" + currentMenu[z].arrowWidth + " height=1 align='absmiddle'><img src=\"../images/nav/arrowSub.gif\" width=3 height=5>";
					theArrow = "";//"<img src=\"../images/nav/arrowNav.gif\" width=5 height=8>";
				}else{
					theArrow = "";//"<img src=\"../images/spacer.gif\" width=5 height=5>";
				}
				if(currentMenu[z].hasSub != null){
					sendSubIndex = currentMenu[z].subIndex;
				}else{
					sendSubIndex = -1;
				}
				outHTML += "<tr  class=\"" + theClass + "\" onMouseOver=\"doSubNav(this,1," + sendSubIndex + "," + rowCount + ");\" onMouseOut=\"//doSubNav(this,0);\" id=\"row" + rowCount + "\" bgcolor='518a2a'><td width=6 bgcolor=518a2a><img src=\"../images/spacer.gif\"  width=6 height=22></td><td width=3><img src=\"../images/spacer.gif\"  width=3 height=22></td></td><td onClick=\"" + theOnClick + ";\">" + theLink + "</td><td width=6><img src=\"../images/spacer.gif\" width=6 height=22></td><td width=0>" + theArrow + "</td></tr>";
				outHTML += "<tr><td width=" + mainNavs[j].theWidth + " bgcolor=\"518a2a\" colspan=5><img src=\"../images/spacer.gif\" width=1 height=1></td></tr>";
				rowCount ++;
			}
			outHTML += "</table>";
		}
		outHTML += "</div>";
	}
	outHTML += "<div id=\"bigHide\" style=\"position:absolute;left:0px;top:" + masterTop + "px;visibility:hidden;z-index:1;\"><a href=\"#\" onMouseOver=\"doMainNav(-1, 'Off')\"><img src=\"../images/spacer.gif\" width=766 height=300 border=0></a></div>";

	outHTML += "<div id=\"bigHide2\" style=\"position:absolute;left:0px;top:0px;hidden:visible;z-index:1;\"><a href=\"#\" onMouseOver=\"doMainNav(-1, 'Off')\"><img src=\"../images/spacer.gif\" width=766 height=40 border=0></a></div>";

	//document.write(outHTML);
	//loaded = true;
	writeSubLayers();
}
function writeSubLayers(){
	for(a = 1; a <= totalSubSubs; a ++){
		currentMenu = eval("subsub" + a);
		theLength = currentMenu.length;
		outHTML += "<div id=\"menuSub" + a + "\" style=\"position:absolute; top:" + currentMenu[0].topPos + "px; left:" + currentMenu[0].leftPos + "px; visibility:hidden; z-index:100;\">";
		outHTML += "<table cellpadding=0 cellspacing=0 border=0 width=160>";
		outHTML += "<tr><td width=160 bgcolor=\"#ffffff\" colspan=3><img src=\"../images/spacer.gif\" width=1 height=1></td></tr>";
			for(z = 0; z < theLength; z ++){
				if(ns){
					theLink = "<a href=\"" + currentMenu[z].goLink + "\">" + currentMenu[z].displayText + "</a>";
					theClass = "subsubNavNS";
				}else{
					theLink = currentMenu[z].displayText;
					theClass = "subsubNav";
				}
				if(currentMenu[z].hasSub != null){
					if(currentMenu[z].hasSub == 1){
						theArrow = "<img src=\"../images/nav/arrowNav.gif\" width=5 height=8>";
					}else{
						theArrow = "<img src=\"../images/spacer.gif\" width=5 height=5>";
					}
					
				}else{
					theArrow = "<img src=\"../images/spacer.gif\" width=5 height=5>";
				}
				if(currentMenu[z].hasSub != null){
					sendSubIndex = currentMenu[z].subIndex;
				}else{
					sendSubIndex = -1;
				}
				outHTML += "<tr class=\"" + theClass + "\" onMouseOver=\"doSubSubNav(this,1," + sendSubIndex + "," + rowSubCount + ");\" onMouseOut=\"//doSubSubNav(this,0);\" id=\"rowSub" + rowSubCount + "\"><td width=6><img src=\"../images/spacer.gif\" width=6 height=32></td><td onClick=\"parent.location='" + currentMenu[z].goLink + "';\" width=154>" + theLink + "</td><td width=7>" + theArrow + "</td></tr>";
				outHTML += "<tr><td width=160 bgcolor=\"#ffffff\" colspan=3><img src=\"../images/spacer.gif\" width=1 height=1></td></tr>";
				rowSubCount ++;
			}
			outHTML += "</table>";
		outHTML += "</div>";
	}
	//document.write(outHTML);
	//loaded = true;
	writeSubSubLayers();
}
function writeSubSubLayers(){
	for(a = 1; a <= totalSubSubSubs; a ++){
		currentMenu = eval("subsubsub" + a);
		theLength = currentMenu.length;
		outHTML += "<div id=\"menuSubSub" + a + "\" style=\"position:absolute; top:" + currentMenu[0].topPos + "px; left:" + currentMenu[0].leftPos + "px; visibility:hidden; z-index:100;\">";
		outHTML += "<table cellpadding=0 cellspacing=0 border=0 width=160>";
		outHTML += "<tr><td width=160 bgcolor=\"ffffff\" colspan=2><img src=\"../images/spacer.gif\" width=1 height=1></td></tr>";
			for(z = 0; z < theLength; z ++){
				if(ns){
					theLink = "<a href=\"" + currentMenu[z].goLink + "\">" + currentMenu[z].displayText + "</a>";
					theClass = "subsubsubNavNS";
				}else{
					theLink = currentMenu[z].displayText;
					theClass = "subsubsubNav";
				}
				outHTML += "<tr class=\"" + theClass + "\" onMouseOver=\"doLastNav(this,1);\" onMouseOut=\"doLastNav(this,0);\"><td width=6><img src=\"../images/spacer.gif\" width=6 height=32></td><td onClick=\"parent.location='" + currentMenu[z].goLink + "';\" width=154>" + theLink + "</td></tr>";
				outHTML += "<tr><td width=160 bgcolor=\"ffffff\" colspan=2><img src=\"../images/spacer.gif\" width=1 height=1></td></tr>";
			}
			outHTML += "</table>";
		outHTML += "</div>";
	}
	document.write(outHTML);
	loaded = true;
}
