/*///////////////////////////////////////////////// 
 Author: Quan Nguyen
   Date: 8/12/06
Purpose: On the page load, load the event handlers
		 and preload the images.
/////////////////////////////////////////////////*/

//If there are any other functions that need to load on the body, then put them here.
window.onload = function() {
	attachMenuEvents();
	preloadImages();
        new validateForm(); 
}

// Attach event handlers to the menus
function attachMenuEvents() {
	var menuLinks = document.getElementById('top-navigation').getElementsByTagName('IMG');

	for (var i = 0; i < menuLinks.length; i++) {
		if (menuLinks[i].src.indexOf('Off') > -1) {
			menuLinks[i].setAttribute("onmouseover", "getHighlightImage(this);");
			menuLinks[i].setAttribute("onmouseout", "getPreviousImage(this);");
		}
	}
}

// Get the "on" image to display
function getHighlightImage(obj) {
	var curState = obj.src;
	obj.src = curState.replace("Off","On")
}

// Get the "off" state image
function getPreviousImage(obj) {
	var curState = obj.src;
	obj.src = curState.replace("On","Off")
}

// Preload Top Nav "On" state images
function preloadImages() {
	var image1 = new Image;
	image1.src = "/fmf/images/top/topHomeOn.jpg";

	var image2 = new Image;
	image2.src = "/fmf/images/top/topAboutOn.jpg";

	var image3 = new Image;
	image3.src = "/fmf/images/top/topFeaturedOn.jpg";

	var image4 = new Image;
	image4.src = "/fmf/images/top/topProductOn.jpg";

	var image7 = new Image;
	image7.src = "/fmf/images/top/topClientOn.jpg";
	
}

function changeBackgroundImage(whatImg) {
	document.getElementById('home-main').className = whatImg;
}