/*
This script controls animation of the navigation buttons.

Functions:
	btnMouseOver(button, mouseOver, btnName)
	Purpose: Alternates an image objects source.
*/


//--------------------------------------------------
// Get button link URLs.
//--------------------------------------------------
// Create an array of link URLs by listing them.
// List one for each up/down button pair.
// There must be one URL for each button.
// List format must be (including comma and quotes)...
// ,"URLtext" 
buttonUrls = new Array("filler" // First index not used.
,"index.htm"
,"index.htm#ceo"
,"benefits.htm"
,"alarm_cos.htm"
,"firedepts.htm"
,"insurance_cos.htm"
,"news.htm"
,"community.htm"
,"pp_presentations.htm"
,"cad_interface_specifications.htm"
,"index.htm#contact"
,"careers.htm"
);


//--------------------------------------------------
// Get button images.
//--------------------------------------------------
// Set path to button image files.
imgPath = "images/";

// Create an array of button image file names by listing them.
// There must be two button images (on/off) for each button.
// List each button up image immediately followed by its down image.
// List format must be (including comma and quotes)...
// 		,"filename.xxx" 
buttonNames = new Array("filler" // First index not used.
,"btn_home.gif"
,"btn_home_on.gif"
,"btn_ceo.gif"
,"btn_ceo_on.gif"
,"btn_benefits.gif"
,"btn_benefits_on.gif"
,"btn_alarmcos.gif"
,"btn_alarmcos_on.gif"
,"btn_firedepts.gif"
,"btn_firedepts_on.gif"
,"btn_insurance.gif"
,"btn_insurance_on.gif"
,"btn_news.gif"
,"btn_news_on.gif"
,"btn_safety.gif"
,"btn_safety_on.gif"
,"btn_pp_presentations.gif"
,"btn_pp_presentations_on.gif"
,"btn_CADspecs.gif"
,"btn_CADspecs_on.gif"
,"btn_contact.gif"
,"btn_contact_on.gif"
,"btn_careers.gif"
,"btn_careers_on.gif"
);


//--------------------------------------------------
// Make an array of button image objects.
//--------------------------------------------------
// Create an array of image objects.
buttonImg = new Array();

// give the objects their respective .src values
for ( i = 0; i < buttonNames.length - 1; i++ ) { 
	buttonImg[i] = new Image();
	buttonImg[i].src = imgPath + buttonNames[i + 1];
}


//--------------------------------------------------
// Functions.
//--------------------------------------------------

//function btnMouseOver(button, mouseOver, btnName, page)
function btnMouseOver(button, mouseOver, btnName)
/*
	Alternates an image objects source.
	button 		- the 'counting' number of the image, starting at zero and incrimenting by one for each new image
	mouseOver 	- binary determinator of which image (on or standard) to show, '1' to show the on image and '0' to show the standard (off) image
	btnName 		- the name of the IMG tag that is to be affected by the function
	Effect: The image that is displayed as 'btnName' is changed to its alternate from the array 'buttonImg'
*/
{
	document [btnName].src = buttonImg[2 * button + mouseOver].src;
	return true;
}


//--------------------------------------------------
// Display buttons on page.
//--------------------------------------------------
// Display each button in array buttonImg[] in file javascript/buttons.js.

// Start button table.
document.write("<table align=left cellpadding=0 cellspacing=0 border=0>");
document.write("<tr>");
document.write("	<td><img src=images/btn_top.gif></td>");
// Right hand spacer column.
document.write("	<td width=10%><img src=images/spacer_trans_1x1.gif></td>");
document.write("</tr>");


// Make table row for each button.
for (i = 0; i < buttonImg.length / 2; i++) {
	document.write("<tr>");
	document.write("	<td colspan=2>");

	// Start link tag and lock down button for the current page.
	document.write("		<A href=" + buttonUrls[i + 1]);
	lockOn = 1;
	if (i != pageNum) {
		// Activate buttons for non-current pages only.
		// "pageNum" is defined on each page listed in buttonUrls[].
		lockOn = 0;	// Unlock non-current page buttons.
		document.write("		onmouseover=\"btnMouseOver(" + i + ", 1, 'button" + i + "')\"");
		document.write("		onmouseout=\"btnMouseOver(" + i + ", 0, 'button" + i + "')\"");
	}
	// End link tag.
	document.write("		>");

	document.write("		<img name=button" + i + " SRC=" + buttonImg[i * 2 + lockOn].src + " border=0></a></td>");
	document.write("</tr>");
}

// End button table.
document.write("<tr>");
document.write("	<td colspan=2><img src=images/btn_bottom.gif></td>");
document.write("</tr>");
document.write("</table>");

