
var arrMenu;
var arrFlyout = new Array();

var clearf; var fAct;

var highlight; 
var highlight_flyout;

var hide_timeout = 2000;

function surf_to(url) {
	window.location=url;
}

function build_menu() {
	var nbContent;
	var foContent;
	var hmRow;

	var menu_sep = new Image();
	menu_sep.src =  "/images/internet/clubmarine/menu_vertbar.gif";

	var fo_sep = new Image(); 
	fo_sep.src = "/images/internet/clubmarine/flyout_vertbar.gif";

	
//	alert("IE build");
	
	foMenu = "<table width='" + nav_wdt + "' class='navbarActive' border='0' cellpadding='0' cellspacing'0'><tr>";
	nbContent = "<tr class='navbar'>";
	foContent = "";
	hmRow = "<tr class='navMenuTop'>";
	
	for(menuLoop = 0; menuLoop < arrMenu.length; menuLoop++) {
		nbContent += "<td id='m" + menuLoop + "' onMouseOver='m_on(this);' onMouseOut='m_off(this);' onClick='surf_to(\"" + arrMenu[menuLoop][1] + "\");' nowrap class='navbar'";

	if (menuLoop == 0) {
 	  nbContent += "style='border-left: 1px solid #043464'"
	} else if (menuLoop == arrMenu.length - 1) {
	  nbContent += "style='border-right: 1px solid #043464'"		
	}

	nbContent += ">" +  arrMenu[menuLoop][0] + "</td>";

 		hmRow += "<td id='hm" + menuLoop + "' class='navMenuTop'>&nbsp;</td>";

		 
		 if(menuLoop < arrMenu.length - 1) {
			hmRow += "<td></td>";
		 	nbContent += "<td class='navbarSeperator'><img src='" + imgPath + "FAI/menu_vertbar.gif' width='2' height='13'></td>";
		}

			
		if(arrFlyout[menuLoop][0][0] != "") {
			foContent += "<div class='navFlyout' id='f" + menuLoop + "' onMouseOver='f_on(this);' onMouseOut='f_off(this);'>";
			foContent += "<table cellpadding='0' cellspacing='0' border='0' height='18px'><tr valign='center'>";
		
			for(flyoutLoop = 0; flyoutLoop < arrFlyout[menuLoop].length; flyoutLoop++) {
				foContent += "<td>";
				
				if(menuLoop == highlight && flyoutLoop == highlight_flyout) {
//				if(menuLoop == highlight) {
					foContent += "<span class='navFlyoutItemHlt'>" + arrFlyout[menuLoop][flyoutLoop][0] + "</span></td>";
				} else {
					foContent += "<a class='navFlyoutItem' href='"  + arrFlyout[menuLoop][flyoutLoop][1] + "'>" + arrFlyout[menuLoop][flyoutLoop][0] + "</a></td>";
				}
				
				if(flyoutLoop < arrFlyout[menuLoop].length - 1) {
					foContent += "<td class='flyoutSeperator'><img src='" + imgPath + "FAI/flyout_vertbar.gif' align='center' width='2' height='11'></td>";
				}  
			}
			
			foContent += "</tr></table>"
			foContent += "</div>";
		} else {
			foContent += "<div id='f" + menuLoop +"' class='navFlyout'>&nbsp;</div>";
		}
		
	}
	
	if(menuLoop < 7) {
			nbContent += "<td width='100%' class='navbar'>&nbsp;</td>";
	}

	
	nbContent += "</tr>";
	hmRow += "</tr>";

	if(b == "ie4") {
	document.all.navbar.innerHTML = "<table width='" + nav_wdt + "' cellpadding='0' cellspacing='0' border='0'>" + hmRow + nbContent + "</table>" + foContent;

//	document.all.foo.value = document.all.navbar.innerHTML;

	} else {
		document.getElementById("navbar").innerHTML = "<table width='" + nav_wdt + "' cellpadding='0' cellspacing='0' border='0'>" + hmRow + nbContent + "</table>" + foContent;
	}
	hide_flyouts(true);
}

function page_load_ie() {
	if(b != "ns4") {
		init_arrays();
		build_menu();
	}
}

function hide_flyouts(showHighlight) {
	for(i = 0; i < arrMenu.length; i++) {
		deactivate_tab(i);
	}
	
	if(highlight != -1 && showHighlight) {
		activate_tab(highlight);
	}
}
		
function hide_menus() {
	var mItem;
	var hmItem;
	
	for(i = 0; i < arrMenu.length; i++) {
		if(b == "ie4") {
			mItem = eval("m" + i);
			hmItem = eval("hm" + i);
		} else {
			mItem = document.getElementById("m" + i);
			hmItem = document.getElementById("hm" + i);
		}
		mItem.className = "navItem";
		hmItem.style.visibility = "hidden";
	}
}	

function m_off(elem) {
	var navID;
	var fElem;
	var hmElem;
		
	navID = elem.id.substr(1);
	//fElem = eval("f" + navID);
//	hmElem = eval("hm" + navID);
	
	//hmElem.style.visibility = "hidden";
	//fElem.style.visibility = "hidden";
	//elem.style.background = "#040464";
	

	
//	elem.className = "navItem";

	clearf = setInterval("hide_flyouts(true);", hide_timeout);
}

function m_on(elem) {
	var navID;

	clearInterval(clearf);
	
	hide_flyouts(false);
	
	navID = elem.id.substr(1);

	activate_tab(navID);
}

function f_on(elem) {
	clearInterval(clearf);
}

function f_off(elem) {
	clearf = setInterval("hide_flyouts(true);", hide_timeout);
}

function activate_tab(tID) {
	var hmElem, mElem, fElem;
	
	if(b == "ie4") {
		hmElem = eval("hm" + tID);
		fElem = eval("f" + tID);
		mElem = eval("m" + tID);
	} else {
		hmElem = document.getElementById("hm" + tID);
		fElem = document.getElementById("f" + tID);
		mElem = document.getElementById("m" + tID);
	}
	
	hmElem.style.visibility = "visible";
	fElem.style.visibility = "visible";

	
	mElem.className = "navItemActive";
}

function deactivate_tab(tID) {
	var hmElem, mElem, fElem;
	
	if(b == "ie4") {
		hmElem = eval("hm" + tID);
		fElem = eval("f" + tID);
		mElem = eval("m" + tID);
	} else {
		hmElem = document.getElementById("hm" + tID);
		fElem = document.getElementById("f" + tID);
		mElem = document.getElementById("m" + tID);
	}
	
	hmElem.style.visibility = "hidden";

	fElem.style.visibility = "hidden";
	
	mElem.className = "navItem";
}

//
//
// START NETSCAPE CODE
//
//
function build_menu_ns() {
	var nbContent = "";
	var	foContent = "";
	var i, itemWidth;
	
	itemWidth = Math.ceil(nav_wdt / arrMenu.length);

	nbContent = ""; 
	
	for(i = 0; i < arrMenu.length; i++) {
		nbContent += "<layer visibility='show' left='" + ((i * itemWidth) + nav_left) + "' width='" + (itemWidth - nav_left) + "' class='navItem' onmouseover='m_on_ns(" + i + ");' onmouseout='m_off_ns(" + i + ");' height='22' name='m" + i + "' top='" + top_nav_top + "'><div align='center' ><img src='" + imgPath + "spacer.gif' width='1' height='5' border='0'><a href='" + arrMenu[i][1] + "' class='navLink'>" + arrMenu[i][0] + "</a></div></layer>"

nbContent += "<layer left='" + (((i+1) * itemWidth)) + "' class='navItem' bgcolor='" + topMenuBg + "' width='" + nav_left + "' valign='center' height='22' top='" + top_nav_top + "'><div align='center' height='22' width='10' class='navItem'><img src='" + imgPath + "spacer.gif' width='1' height='5' border='0'><br>"

if( i < arrMenu.length - 1) {
	nbContent += "<img src='" + imgPath + "FAI/menu_vertbar.gif' align='middle' border='0'></div></layer>";
}

nbContent += "</div></layer>";

		foContent += "<layer visibility='hide' name='f" + i + "' class='navFlyout' width='" + nav_wdt + "' bgcolor='" + botMenuBg + "' left='" + nav_left + "' height='20' top='" + bot_nav_top + "' onmouseover='f_on_ns()' onmouseout='f_off_ns()'><img src='" + imgPath + "spacer.gif' width='710' height='2' border='0' align='top'><br><img src='" + imgPath + "spacer.gif' width='10' height='1' border='0' align='top'>";

//		foContent += "<br>"

		if(arrFlyout[i][0][0] != "") {
			for(j = 0; j < arrFlyout[i].length; j++) {

				foContent += "<a class='flyoutLink' href='" + arrFlyout[i][j][1] + "'>" + arrFlyout[i][j][0] + "</a>";
				if(j < arrFlyout[i].length - 1) {
					foContent += " <img src='" + imgPath + "FAI/flyout_vertbar.gif' align='absmiddle'> ";
				}
			}
		} else {
			foContent += "&nbsp;";
		}
		
		foContent += "</layer>";
	}
	
//	nbContent += "</layer>";

	document.write(nbContent + foContent);

	hide_flyouts_ns(true);
}

function page_load_ns() {

//	alert('ns menu!');

	init_arrays();
	build_menu_ns();
}



function hide_flyouts_ns(showHighlight) {
	
	for(i = 0; i < arrMenu.length; i++) {
		fLayer = eval("document.layers['f" + i + "']");
		mLayer = eval("document.layers['m" + i + "']");

		fLayer.visibility = "hide";
		mLayer.bgColor = topMenuBg;
	}

	if(highlight != -1 && showHighlight) {
		activate_tab_ns(highlight);
	}

	clearInterval(clearf);
}		

function m_off_ns(elem) {
	var navID;
	var fElem;
	var hmElem;

	clearf = setInterval("hide_flyouts_ns(true);", hide_timeout);
}

function m_on_ns(onID) {

	clearInterval(clearf);
	
	hide_flyouts_ns(false);
	
	activate_tab_ns(onID);
}

function f_on_ns() {
	clearInterval(clearf);
}

function f_off_ns() {
	clearf = setInterval("hide_flyouts_ns(true);", hide_timeout);
}

function activate_tab_ns(tID) {

	fLayer = eval("document.layers['f" + tID + "']");
	mLayer = eval("document.layers['m" + tID + "']");
	
	fLayer.visibility = "show";
	mLayer.bgColor = botMenuBg;
}

function deactivate_tab_ns(tID) {
	mLayer = eval("document.layers['f" + tID + "']");
	fLayer = eval("document.layers['f" + tID + "']");

	fLayer.visibility = "hide";
	mLayer.bgColor = topMenuBg;
}
