var browserName = navigator.appName;
var browserAppVersion = navigator.appVersion;

if (pageOn == "aboutus") pageOn = "aboutUs";
if (pageOn == "neighborworksProgs") pageOn = "neighborworksprogs";
	
function makeSubMenu(pageOn, subPageOn) {
	for (x=0; x<arrMenu.length; x++) {
		menu = arrMenu[x];
	
		if (menu[0] == pageOn) {
	
			if (menu[1] != "") {
				document.write("<table width=\"146\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
				document.write("<td bgcolor=\"#336574\"><img src=\"/network/images/spacer.gif\" alt=\"\" width=\"1\" height=\"5\"></td>");
				document.write("<td rowspan=\"3\" bgcolor=\"#12313A\"><img src=\"/network/images/spacer.gif\" alt=\"\" width=\"5\" height=\"1\"></td>");
				document.write("</tr><tr>");
				document.write("<td bgcolor=\"#336574\">");
		
				subMenu = eval(menu[1]);
				for (y=0; y<subMenu.length; y++) {
					state = "";
					if (subPageOn == subMenu[y][2]) {
						state = "_active";
					}
					document.write("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr>");
					document.write("<td><a href=\"" + subMenu[y][1] + "\" class=\"submenu" + state + "\">" + subMenu[y][0] + "</a></td>");
					document.write("</tr></table>");
				}
				
				document.write("</td></tr><tr>");
				document.write("<td bgcolor=\"#336574\"><img src=\"/network/images/spacer.gif\" alt=\"\" width=\"1\" height=\"5\"></td>");
				document.write("</tr></table>");
			} else {
				document.write("<img src=\"/network/images/spacer.gif\" height=\"1\" width=\"146\" alt=\"\">");
			}
		}
	}
}

function makeTabMenu(pageOn, subPageOn, tab) {
	tabs = false;
	for (x=0; x<arrMenu.length; x++) {
		menu = arrMenu[x];
		if ((menu[0] == pageOn) && (menu[2] != "")) { // means top level with no sub menu, just tabs
			tabMenu = eval(menu[2]);
			tabs = true;
		} else if ((menu[0] == pageOn) && (menu[1] != "")) { // means sub level page with tab menu
			subMenu = eval(menu[1]);
			for (y=0; y<subMenu.length; y++) {
				if ((subPageOn == subMenu[y][2]) && (subMenu[y][3] != "")) {
					tabMenu = eval(subMenu[y][3]);
					tabs = true;
				}
				if (tabs) break;
			}
		}
		if (tabs) break;
	}

	if (tabs) {
		path = "";
		document.write("<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"><tr>");
		document.write("<td valign=\"bottom\" align=\"center\">&nbsp;");
		for (z=0; z<tabMenu.length; z++) {
			state = "";
			if (tabMenu[z][1] == tab) {
				state = "_active";
			}
			if ((pageOn == "training") || (pageOn == "neighborworksprogs")){
				tabs = tabMenu[z][1];
				page = tabs.split(":");
				if (page.length < 2) {
					page = tabs.split("/")
				}
				if ((page[0] != "javascript") && (page.length < 3)) {
					path = "/network/" + pageOn + "/" + subPageOn + "/";
				} else {
					path = "";
				}
			}
			document.write("<a href=\"" + path + tabMenu[z][1] + "\" class=\"tab" + state + "\">" + tabMenu[z][0] + "</a>");
		}
		document.write("</td></tr><tr>");
		document.write("<td bgcolor=\"#648D9F\" height=\"6\"><img src=\"/network/images/spacer.gif\" alt=\"\" width=\"1\" height=\"6\"></td>");
		document.write("<tr><td>&nbsp;</td></tr>");
		document.write("</table>");
	} else {
		document.write("<img src=\"/network/images/spacer.gif\" height=\"1\" width=\"1\" alt=\"\">");
	}
}

function makeSiteMap(pageOn) {
	for (x=0; x<arrMenu.length; x++) {
		menu = arrMenu[x];
	
		if (menu[0] == pageOn) {
	
			if (menu[1] != "") {
				document.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
				subMenu = eval(menu[1]);
				for (y=0; y<subMenu.length; y++) {
					document.write("<tr><td><div class=\"indent\"><a href=\"" + subMenu[y][1] + "\" class=\"sitemapLinks\">" + subMenu[y][0] + "</a></div></td></tr>");
				}
				document.write("</table>");
			} else {
				document.write("<img src=\"/network/images/spacer.gif\" height=1 width=1 alt=\"\">");
			}
		}
	}
}

function popUp(url) {
	genPopUp = window.open("","pop","toolbar=no,location=no,scrollbars=yes,directories=no,status=yes,menubar=no,resizable=yes,width=600,height=400");
	genPopUp.location.href = url;
	if (genPopUp.opener == null) genPopUp.opener = window;
	genPopUp.opener.name = "opener";
}

function openNew(url) {
	genPopUp = window.open("","pop");
	genPopUp.location.href = url;
	if (genPopUp.opener == null) genPopUp.opener = window;
	genPopUp.opener.name = "opener";
}


function printerFriendly() {
	genPopUp = window.open("","printer","toolbar=no,location=no,scrollbars=yes,directories=no,status=yes,menubar=yes,resizable=yes,width=760,height=600");
	genPopUp.location.href = "/network/print.asp";
	if (genPopUp.opener == null) genPopUp.opener = window;
	genPopUp.opener.name = "opener";
}

function newHeight(obj) {
	aID = obj.id; 
	if (document.getElementById(aID).contentDocument){
		obj.style.height = document.getElementById(aID).contentDocument.body.scrollHeight;
	} else {
		obj.style.height = document.frames(aID).document.body.scrollHeight;
	} 
}

function goodbye(){
	window.close();
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);