// This function will load all of the images used by the menu system.
function loadImages(strPage){

	// Set up the path to the images.
	if (strPage.indexOf("Home") != -1)
		var strPath = "./Images/";
	else
		var strPath = "../Images/";


	// Create & load up the Image objects used on all the pages.
	offices_off = new Image();
	offices_on = new Image();
	services_off = new Image();
	services_on = new Image();
	products_off = new Image();
	products_on = new Image();
	news_off = new Image();
	news_on = new Image();
	about_off = new Image();
	about_on = new Image();
	contact_off = new Image();
	contact_on = new Image();

	offices_off.src = strPath + "Offices.gif";
	offices_on.src = strPath + "Offices_On.gif";
	services_off.src = strPath + "Services.gif";
	services_on.src = strPath + "Services_On.gif";
	products_off.src = strPath + "Products.gif";
	products_on.src = strPath + "Products_On.gif";
	news_off.src = strPath + "News.gif";
	news_on.src = strPath + "News_On.gif";
	about_off.src = strPath + "About.gif";
	about_on.src = strPath + "About_On.gif";
	contact_off.src = strPath + "Contact.gif";
	contact_on.src = strPath + "Contact_On.gif";


	// Create & load up the Image objects specific to the Home Page.
	if (strPage.indexOf("Home") != -1){
		officesUM = new Image();
		servicesUM = new Image();
		productsUM = new Image();
		productsLM = new Image();
		newsUM = new Image();
		aboutUM = new Image();
		uppermenu_off = new Image();
		lowermenu_off = new Image();

		officesUM.src = strPath + "Offices_UM.gif";
		servicesUM.src = strPath + "Services_UM.gif";
		productsUM.src = strPath + "Products_UM.gif";
		productsLM.src = strPath + "Products_LM.gif";
		newsUM.src = strPath + "News_UM.gif";
		aboutUM.src = strPath + "About_UM.gif";
		uppermenu_off.src = strPath + "Blank_UM.gif"; 
		lowermenu_off.src = strPath + "Blank_LM.gif";
	}
}





// This function will turn on & off the roll over images.
function menuLinks (iOption, strPage){

	// Set up the variables for this function.
	var d = document;


	// Turn off all of the menu items.
	d.Offices.src = offices_off.src;
	d.Services.src = services_off.src;
	d.Products.src = products_off.src;
	d.News.src = news_off.src;
	d.About.src = about_off.src;
	d.Contact.src = contact_off.src;


	// Turn on the Main Menu item for this page & it's sub-pages.
	switch(strPage){
		case "Offices":
			d.Offices.src = offices_on.src;
			break;
		case "Services":
			d.Services.src = services_on.src;
			break;
		case "Products":
			d.Products.src = products_on.src;
			break;
		case "News":
			d.News.src = news_on.src;
			break;
		case "About":
			d.About.src = about_on.src;
			break;
		case "Contact":
			d.Contact.src = contact_on.src;
			break;
	}


	// Turn on the menu item of iterest.
	switch(iOption){
		case 1:
 			d.Offices.src = offices_on.src;
			break;
		case 2:
			d.Services.src = services_on.src;
			break;
		case 3:
			d.Products.src = products_on.src;
			break;
		case 4:
			d.News.src = news_on.src;
			break;
		case 5:
			d.About.src = about_on.src;
			break;
		case 6:
			d.Contact.src = contact_on.src;
			break;
	}
}





function menuLinksHome (iOption){

	// Set up the variables for this function.
	var d = document;
	var x;


	// Turn off all of the menu items.
	d.Offices.src = offices_off.src;
	d.Services.src = services_off.src;
	d.Products.src = products_off.src;
	d.News.src = news_off.src;
	d.About.src = about_off.src;
	d.Contact.src = contact_off.src;
	d.upperM.src = uppermenu_off.src;
	d.lowerM.src = lowermenu_off.src;
	for (x = 0; x < 8; x++){
		d.links[x].href = "index.html";
		d.links[x].alt = "";
	}


	// Turn on the menu item of iterest.
	switch(iOption){
		case 1:
			//  Menu and links displayed when user mouseovers Offices button. 
			d.Offices.src = offices_on.src;        
			d.upperM.src = officesUM.src;
			d.links[0].href = "./offices/teco.html";
			d.links[0].alt = "Toledo Engineering Co., Inc."
			d.links[1].href = "./offices/ktgsi.html";
			d.links[1].alt = "KTG Systems, Inc."
			d.links[2].href = "./offices/tecoglas.html";
			d.links[2].alt = "TECOGLAS, Ltd."
			d.links[3].href = "./offices/ktg.html";
			d.links[3].alt = "KTG Engineering, Ltd."
                  d.links[4].href = "./offices/zedtec.html";
			d.links[4].alt = "ZEDTEC, Ltd."
			break;
		case 2:
			//  Menu and links displayed when user mouseovers Services button. 
			d.Services.src = services_on.src;
			d.upperM.src = servicesUM.src;
			d.links[0].href = "./services/turnkey.html";
			d.links[0].alt = "Turnkey Capabilities"
			d.links[1].href = "./services/modeling.html";
			d.links[1].alt = "Furnace Modeling"
			d.links[2].href = "./services/audit.html";
			d.links[2].alt = "Furnace Audits/Training"
			d.links[3].href = "./services/repair.html";
			d.links[3].alt = "Hot Repairs"
			break;
		case 3:
			//  Menu and links displayed when user mouseovers Products button. 
			d.Products.src = products_on.src;
			d.upperM.src = productsUM.src;
			d.lowerM.src = productsLM.src;
			d.links[0].href = "./products/furnaces.html";
			d.links[0].alt = "Glass Furnaces"
			d.links[1].href = "./products/bubblers.html";
			d.links[1].alt = "Bubbler Systems"
			d.links[2].href = "./products/boost.html";
			d.links[2].alt = "Electric Boost"
			d.links[3].href = "./products/forehearth.html";
			d.links[3].alt = "Distributors & Forehearths"
			d.links[4].href = "./products/environmental.html";
			d.links[4].alt = "Environmental"
			d.links[5].href = "./products/batch.html";
			d.links[5].alt = "Batch Plants"
			d.links[6].href = "./products/control.html";
			d.links[6].alt = "Control Systems"
			d.links[7].href = "./products/equipment.html";
			d.links[7].alt = "Equipment/Parts"
			break;
		case 4:
			//  Menu and links displayed when user mouseovers News button. 
			d.News.src = news_on.src;
			d.upperM.src = newsUM.src;
			d.links[0].href = "./news/projects.html";
			d.links[0].alt = "Recent Projects"
			d.links[1].href = "./news/brochures.html";
			d.links[1].alt = "Brochures/Downloads"
			d.links[2].href = "./news/papers.html";
			d.links[2].alt = "Technical Papers"
                        d.links[3].href = "./news/videos.html";
			d.links[3].alt = "Videos"
			d.links[4].href = "./news/tradeshows.html";
			d.links[4].alt = "Trade Shows"
			break;
		case 5:
			//  Menu and links displayed when user mouseovers About button. 
			d.About.src = about_on.src;
			d.upperM.src = aboutUM.src;
			d.links[0].href = "./about/faq.html";
			d.links[0].alt = "Frequently Asked Questions"
			d.links[1].href = "./about/personnel-teco.html";
			d.links[1].alt = "Key Personnel"
			d.links[2].href = "./about/history.html";
			d.links[2].alt = "History"
			d.links[3].href = "./about/mission.html";
			d.links[3].alt = "Mission & Values"
			break;
		case 6:
			//  Menu and links displayed when user mouseovers Contact button. 
			d.Contact.src = contact_on.src;
			break;
	}
}





function writeHeader(){
	document.write("<table height='100' align='center' width='740' border='0' cellspacing='0' cellpadding='0'>");
		document.write("<tr>");
			document.write("<td width='320' align='left' valign='top' rowspan='2'><a href='../index.html'><img src='../Images/TECOlogoheader1.jpg' alt='Toledo Engineering Co., Inc.'border='0'></td>");
			document.write("<td width='300' align='right' valign='top'><a href='../index.html'><img src='../Images/Home.gif' alt='Home' border='0'></a></td>");
			document.write("<td width='120' align='center' valign='center'><img src='../Images/80 yr logo4.jpg' alt='TECO 80 Years' border='0'></td>");
		document.write("</tr>");
		document.write("<tr>");
			document.write("<td colspan='2'>");
				document.write("<table align='center' width='100%' border='0' cellspacing='0' cellpadding='0'>");
					document.write("<tr>");
						document.write("<td align='right' valign='bottom' colspan='2'>");
							document.write("<font color='gray' size='1'>");
							writeDate();
							document.write("</font>");
						document.write("</td>");
						document.write("<td width='20'></td>");
					document.write("</tr>");
				document.write("</table>");
			document.write("</td>");
		document.write("</tr>");
	document.write("</table>");
}





function writeFooter (strPage){
	document.write("<table align='center' width='740' border='0' cellspacing='0' cellpadding='0'>");
		document.write("<tr height='35'>");

			// The path to the .gif is different for the Home Page.
			if (strPage.indexOf("Home") != -1)
				document.write("<td align='left' valign='bottom'><a href='#top'><img src='./Images/backtotop.gif' height='18' width='12' border='0' alt='Back to Top of Page'></a><font size='1'>&nbspBack to Top</font></td>");
			else
				document.write("<td align='left' valign='bottom'><a href='#top'><img src='../Images/backtotop.gif' height='18' width='12' border='0' alt='Back to Top of Page'></a><font size='1'>&nbspBack to Top</font></td>");

			document.write("<td align='right' valign='bottom'><a href='mailto:?subject=A Link from Toledo Engineering Co., Inc.&body=This link is from the TECO Web Site." + escape(location.href) + "'><font size='1'>E-mail this page</font></a></td>");
		document.write("<tr>");
		document.write("<tr>");
			document.write("<td colspan='2'><hr size='3'></td>");
		document.write("</tr>");
		document.write("<tr>");
			document.write("<td align='left'><font size='1'>");
				writeLastModified();
				document.write("</font>");
			document.write("</td>");
			document.write("<td width='370' align='right'><font size='1'>© 2009 Toledo Engineering Co., Inc.</font></td>");
		document.write("</tr>");
		document.write("<tr>");
			document.write("<td width='370'></td>");
			document.write("<td align='right' width='370'><font size='1'>®TECO is a registered trademark of Toledo Engineering Co,. Inc. in the U.S.A.</font></td>");
		document.write("</tr>");
	document.write("</table>");
}





function writeDate(){
	var datToday = new Date;
	var arrNumbers = new Array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31');
	var arrDays = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
	var arrMonths = new Array('January', 'February', 'March', ' April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
	document.write(arrDays[datToday.getDay()] + '&nbsp&nbsp' + arrMonths[datToday.getMonth()] + ' ' + arrNumbers[datToday.getDate()-1] + ', ' + datToday.getFullYear());
}





function writeLastModified(){
	if(Date.parse(document.lastModified) != 0){
   		var datLastMod = new Date(document.lastModified);
   		var arrNumbers = new Array('00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31');
   		var arrMonths = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
   		document.write("Last Modified: " + arrNumbers[datLastMod.getDate()] + arrMonths[datLastMod.getMonth()] + String(datLastMod.getFullYear()).substr(2,2));
		}
	else
   		document.write("Last Modified: Unknown");
}
