// JavaScript Document

//Pre-Cache the images
var navItem = new Array();
	navItem[0] = "btn_consulting";
	navItem[1] = "btn_exhibits";
	navItem[2] = "btn_marketing";
	navItem[3] = "btn_market2";
	navItem[4] = "btn_exhibits2";
	navItem[5] = "btn_contact";

	
if (document.images) {
	var imageOff = new Object();
	for (i=0; i< navItem.length; i++) {
		/* imageOff[navItem[i]] = new Image(height, width); Works better (loads faster) because the browser doesn't have to wiat for the image to load before it calculates the size. */
		imageOff[navItem[i]] = new Image();
		imageOff[navItem[i]].src = "images/"+navItem[i]+".jpg";
		}
	var imageOn = new Object();	
	for (h=0; h< navItem.length; h++) {
		imageOn[navItem[h]] = new Image();
		imageOn[navItem[h]].src = "images/"+navItem[h]+"-over.jpg";
	}
}
	
//Swap image function that excludes the link when the body id matches: works in IE
function setImage(imgID, type) {
	if (document.images) {
		if (type == "on") { //If the type is equal to "on"
			document.getElementById(imgID).src = imageOn[imgID].src; // Replace the current image with the "-over" image
			return true;
		} else if (type == "off") { //If the type is equal to "off"
			var bodyID = document.getElementsByTagName("body")[0].id; //Get the body ID 
			if ("btn_"+bodyID == imgID) {
				document.getElementById(imgID).src = imageOn[imgID].src; // Replace the current image with the "-over" image
				} else {
				document.getElementById(imgID).src = imageOff[imgID].src; // Set the current image to its off state
			}
			return true;
			}
		}
		return false;
	}
	