//Global variables
var idNum = 10;//used to assign unique ID number for <a> tags
var menuTop = 45;//position of header from the top of  then screen
var menuLeft = 400;//position of header from the left of the screen
var domSMenu = null;//used to identify browser
var oldDomSMenu = null;//used in identifing browser
var t = 0;
var lDelay = 3;//time before submenu disappears
var lCount = 0;
var pause = 100;

NS6 = (document.getElementById&&!document.all);
IE = (document.all);
NS = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4");
leftMenuItems=new Array();
leftLinks=new Array();
YOffset=100; // no quotes!!
XOffset=100;

menuBGColor="#6699CC";
menuWidth=100; // Must be a multiple of 10! no quotes!!
CellBGColor="#336699";
CellOverBGColor="#E3F1E5";
linkTarget="_top";
linkAlign="Left";
barWidth=15; // no quotes!!
textOverBGColor="orange";
textOffBGColor="white";
leftMenuWidth ="115"

//Build arrays
//sub menus. Header array items must match with number of submenus.
menu0=new Array()//name,url
menu0[0]=["California State History", "http://www.worldstrides.com/california/california.asp"]
menu0[1]=["Christian Discoveries", "http://www.worldstrides.com/christiandiscoveries/christiandiscoveries.asp"]
menu0[2]=["Parades &amp; Bowl Games", "http://www.worldstrides.com/paradesbgames/Paradesbowlgames.asp"]
menu0[3]=["Performing Arts: Music Festivals", "http://www.worldstrides.com/performing/musicfest.asp"]
menu0[4]=["Performing Arts: Theater", "http://www.worldstrides.com/performing/theater.asp"]
menu0[5]=["Science", "http://www.worldstrides.com/science/default.asp"]

menu0[6]=["U.S. History", "http://www.worldstrides.com/programs/history.asp"]


menu1=new Array()//name,url
menu1[0]=["Boston", "http://www.worldstrides.com/destination/boston.asp"]
menu1[1]=["Florida", "http://www.worldstrides.com/destination/florida.asp"]
menu1[2]=["Hawaii", "http://www.worldstrides.com/destination/hawaii.asp"]
menu1[3]=["New York", "http://www.worldstrides.com/destination/newyork.asp"]
menu1[4]=["Philadelphia", "http://www.worldstrides.com/destination/philadelphia.asp"]
menu1[5]=["Sacramento", "http://www.worldstrides.com/destination/sacramento.asp"]
menu1[6]=["San Diego", "http://www.worldstrides.com/destination/sandiego.asp"]
menu1[7]=["San Francisco", "http://www.worldstrides.com/destination/sanfrancisco.asp"]
menu1[8]=["Washington D.C.", "http://www.worldstrides.com/destination/washingtondc.asp"]
menu1[9]=["Williamsburg", "http://www.worldstrides.com/destination/williamsburg.asp"]
menu1[10]=["Bowl Games &amp; Parade Locations", "http://www.worldstrides.com/destination/bowlgameparade.asp"]
menu1[11]=["MusicFestivals Locations", "http://www.worldstrides.com/destination/musicfestivals.asp"]



menu2=new Array()//name,url







menu3=new Array()//name,url





menu4=new Array()//name,url


header =new Array()//,url,Image url,submenu name, array for corresponding submenu
header[0]=["http://www.worldstrides.com/programs/default.asp","../images/toptabs/o1_on.gif","menu0",menu0]
header[1]=["http://www.worldstrides.com/destination/default.asp","../images/toptabs/o2_on.gif","menu1",menu1]
header[2]=["http://www.worldstrides.com/student_center/town.html","../images/toptabs/o3_on.gif","menu2",menu2]
header[3]=["http://www.worldstrides.com/parents/default.asp","../images/toptabs/o4_on.gif","menu3",menu3]
header[4]=["http://www.worldstrides.com/educators/default.asp","../images/toptabs/o5_on.gif","menu4",menu4]

// leftMenuItems[...]=[name, url]
leftMenuItems[0]=["Home", "http://www.worldstrides.com/main/default.asp"]
leftMenuItems[1]=["Mission", "http://www.worldstrides.com/mission/default.asp"]
leftMenuItems[2]=["Safety First", "http://www.worldstrides.com/safetyfirst/default.asp"]
leftMenuItems[3]=["Accreditation", "http://www.worldstrides.com/accreditation/default.asp"]
leftMenuItems[4]=["Testimonials", "http://www.worldstrides.com/testimonial/default.asp"]
leftMenuItems[5]=["Quality of Services", "http://www.worldstrides.com/quality/default.asp"]
leftMenuItems[6]=["Financial Center", "http://www.worldstrides.com/financial/default.asp"]
leftMenuItems[7]=["Airline Updates", "http://www.worldstrides.com/Airlineupdate/default.asp"]
leftMenuItems[8]=["Sites & Snapshots", "http://www.worldstrides.com/learning_center/index.asp"]
leftMenuItems[9]=["Events", "http://www.worldstrides.com/events/default.asp"]
leftMenuItems[10]=["Merchandise", "http://www.worldstrides.com/merchandise/default.asp"]
leftMenuItems[11]=["About WorldStrides", "http://www.worldstrides.com/about/default.asp"]



//Links not included in left table menu.
// leftLinks[...]=[name, url] 
leftLinks[0]=["FAQ's", "http://www.worldstrides.com/faq/default.asp"]
leftLinks[1]=["Contact Us", "http://www.worldstrides.com/contact/default.asp"]
leftLinks[2]=["Be a Program Leader", "http://www.worldstrides.com/programleader/default.asp"]

//cities for weather
var weather=''
weather += '<option>City</option>'
weather += '<option value="http://www.srh.noaa.gov/data/forecasts/DCZ001.php?warncounty=DCC001&city=Washington">Washington</option>'
weather += '<option value="http://www.srh.noaa.gov/data/forecasts/NYZ075.php?warncounty=NYC047&city=New+York">NewYork</option>'
weather += '<option value="http://www.srh.noaa.gov/data/forecasts/FLZ045.php?warncounty=FLC095&city=Orlando">Orlando</option>'
weather += '<option value="http://www.srh.noaa.gov/data/forecasts/FLZ045.php?warncounty=FLC095&city=Orlando">Orlando</option>'



buildHeader();
buildSubMenu();
buildMainTable();
buildLeftMenu();


function buildHeader(){
	document.write('<div id="menuHead" class="menuStyle">')
	document.write('<table width="780" background="../images/toptabs/background.gif" border="0" cellpadding="0" cellspacing="0"><tr>')
	document.write('<td><img SRC="../images/toptabs/front.gif" border="0"  HEIGHT="49"></td>')
	for(i=0;i<header.length;i++){
		document.write('<td id="menuHead'+i+'"><a id="link'+i+'" class="menuHead'+i+'" href="'+header[i][0]+'" onMouseOut="t = 1;delayHide()" onMouseOver="popMenu('+i+')"><img SRC="'+header[i][1]+'" border="0" WIDTH="90" HEIGHT="49"></a></td>')
	}
	document.write('<td width = "100%" align="right"><img SRC="../images/toptabs/back3.gif" ></td>')
	document.write('</tr></table>')
	document.write('</div>')
	//add the blue spacer bar here
	


}

function buildSubMenu(){
		for(i=0;i<header.length;i++){
			menu = eval("menu" + i);
			document.write('<div class="leftmenu" id="menu'+i+'"><table border="0" cellpadding="2" cellspacing="0" width="'+(menuWidth+barWidth)+'">')
			for(k=0;k<menu.length;k++){
				url = menu[k][1] 
				document.write('<tr><td onclick="ClickMe(\''+url+'\')" BGCOLOR="'+CellBGColor+'" onmouseover="bgColor=\''+CellOverBGColor+'\';HoverOn('+idNum+');t = 2" onmouseout="bgColor=\''+CellBGColor+'\';HoverOff('+idNum+');t = 1; delayHide()" ><a class="leftmenu" id="link'+idNum+'" onmouseover="t=2" onmouseout="t=1; delayHide()" onClick="t=0; delayHide();" href="'+menu[k][1]+'">'+menu[k][0]+'</a></td></tr>');
				idNum = idNum + 1;
			}
		document.write('</table></div>')
		}
}

function buildMainTable(){//Table is built here that encompasses left navigation, information in the middle, right navigation, and bottom navigation
	if (IE||NS6){document.write('<div id=maintable>')}
	if (NS){document.write('<layer name="maintable" width="780" left="0" top="59">')}
	document.write('<table width="780" border="0" cellspacing="0" cellpadding="0">')
	document.write('<tr><td rowspan="2" valign="top" width="'+leftMenuWidth+'" bgcolor="'+menuBGColor+'">')
	document.write('<table width="'+leftMenuWidth+'" border="0" cellpadding="0" cellspacing="0"><tr><td>')

}
function buildLeftMenu(){

	if (IE||NS6){
		document.write('<DIV ID="leftmenu" style="Position : relative ;Left : 0 ;Top : 0 ;Z-Index : 20">')
	}
	if (NS6){
		document.write('<table border="0" cellpadding="0" cellspacing="0"><TR><TD>')
	}
	if (NS){
		document.write('<layer name="leftmenu" width="115" top="0" left="0">')
	}
	document.write('<img SRC="../images/blue.gif" width="115" height="10">');
	
	document.write('<table border="0" cellpadding="3" cellspacing="1" bgcolor="'+menuBGColor+'" width="'+leftMenuWidth+'">');
	
	for(i=0;i<leftMenuItems.length;i++){
		url = leftMenuItems[i][1] 
		document.write('<TR><TD CLASS="leftmenu" onclick="ClickMe(\''+url+'\')" BGCOLOR="'+CellBGColor+'" onmouseover="bgColor=\''+CellOverBGColor+'\';HoverOn('+idNum+')" onmouseout="bgColor=\''+CellBGColor+'\';HoverOff('+idNum+')"><ilayer><layer><A id="link'+idNum+'" HREF="'+leftMenuItems[i][1]+'" CLASS="leftmenu"><img src="../images/1x1clear.gif" height="5" width="8" border="0">'+leftMenuItems[i][0]+'</A></layer></ilayer></TD></TR>'); idNum = idNum + 1
	}
	document.write('</table>')
	document.write('<layer><table bgcolor="'+menuBGColor+'" border="0" cellpadding="1" cellspacing="0" width="'+leftMenuWidth+'">');
	document.write('<tr><td bgcolor="#FFFFFF"><img src="../images/1x1clear.gif" height="5" width="8"></td></tr>')
	for(i=0;i<leftLinks.length;i++){
		document.write('<tr><TD onmouseover="HoverOn('+idNum+')" onmouseout="HoverOff('+idNum+')"><ilayer><layer><a id="link'+idNum+'" href="'+leftLinks[i][1]+'" class="leftmenu"><img src="../images/1x1clear.gif" height="5" width="8" border="0">'+leftLinks[i][0]+'</layer></ilayer></a></TD></tr>'); idNum = idNum + 1
	}
	document.write('<tr><TD bgcolor="#FFFFFF"><img src="../images/1x1clear.gif" height="5" width="8"></TD></tr>')
	//document.write('<tr><td class="leftmenu"><img src="../images/1x1clear.gif" height="5" width="8">Weather</tr></td>')
	//document.write('<tr><td><img src="../images/1x1clear.gif" height="5" width="8"><select name="weather" onChange="goThere()">'+weather+'</select></tr></td>')
	document.write('</table><layer>')
	if (IE||NS6){
		document.write('</DIV>')
	}
	if (NS6){
		document.write('</TD></TR></TABLE>')
	}
	if (NS){
		document.write('</layer>')
	}

//curlycue-------------------------------
	document.write('</td></tr></table></td><td valign="top"><img src="../images/toptabs/lfttop.gif" width="10" height="10"></td>')
	document.write('<td  rowspan="2" valign="top"> ')

}
function goThere(){
	
	var list = document.all.weather
	window.open(list.options[list.selectedIndex].value,'','width=683,scrollbars=yes,height=300')
}

function HoverOn(Num){
	var idSa = 'link' + Num;var domSa = findDOM(idSa,1);domSa.color = textOverBGColor
}

function HoverOff(Num){
	var idSa = 'link' + Num;var domSa = findDOM(idSa,1);domSa.color = textOffBGColor
}

function ClickMe(location){
	window.location = location 
}

function popMenu(menuNum){
	if (isDHTML) {t = 2;
		if (oldDomSMenu){
			oldDomSMenu.visibility = 'hidden'; oldDomSMenu.zIndex = '0';t = 2;lCount = 0;
		}
		var idMenu = 'menuHead';
		var domMenu = findDOM(idMenu,0);
		var idMenuOpt = 'menuHead' + menuNum;
		var domMenuOpt = findDOM(idMenuOpt,0);
		var idSMenu = 'menu' + menuNum;
		var domSMenu = findDOM(idSMenu,1);
		if (isID || isAll) {
			var menuLeft = (domMenu.offsetLeft) + (domMenuOpt.offsetLeft) + 5;var menuTop = (domMenu.offsetTop) + (domMenu.offsetHeight) ;
		}
		if (isLayers) {
			var menuLeft = document.layers[idMenu].layers[idMenuOpt].pageX - 0;var menuTop = domMenu.pageY + domMenu.clip.height - 0;
		}
		if (oldDomSMenu != domSMenu){
			domSMenu.left = menuLeft;domSMenu.top = menuTop;domSMenu.visibility = 'visible';domSMenu.zIndex = '100';oldDomSMenu = domSMenu;
		}
		else { oldDomSMenu = null; 
		}
	}
	else { 
		return null; 
	}
}
function delayHide() {
	if ((oldDomSMenu) && (t == 0)){
		oldDomSMenu.visibility = 'hidden';oldDomSMenu.zIndex = '0';oldDomSMenu = null;lCount = 0;return false;
	}
    if (t == 2) { 
		lCount = 0; return false; 
	}
    if (t == 1) {
		lCount = lCount + 1;if (lDelay <= lCount) { 
			t = 0; 
		}
		if (lDelay >= lCount) { 
			setTimeout('delayHide(' + t + ')',pause); 
		}
	}
}
