//set image name to what is needed by the code
currentNav = "img" + currentNav;

// Image pre-loading for nav
//Modify the images for the nav items for each page as appropriate
imgHomeHover = new Image();      
imgHomeHover.src = "./images/" + imagePrefix + "_nav_home_HOVER.gif";
imgHomeOff = new Image(); 
imgHomeOff.src = "./images/" + imagePrefix + "_nav_home_UP.gif";
imgHomeOn = new Image();
imgHomeOn.src = "./images/" + imagePrefix + "_nav_home_ON.gif";

imgWhatHover = new Image();      
imgWhatHover.src = "./images/" + imagePrefix + "_nav_what_HOVER.gif";
imgWhatOff = new Image(); 
imgWhatOff.src = "./images/" + imagePrefix + "_nav_what_UP.gif";
imgWhatOn = new Image();
imgWhatOn.src = "./images/" + imagePrefix + "_nav_what_ON.gif";

imgWhoHover = new Image();      
imgWhoHover.src = "./images/" + imagePrefix + "_nav_who_HOVER.gif";
imgWhoOff = new Image(); 
imgWhoOff.src = "./images/" + imagePrefix + "_nav_who_UP.gif";
imgWhoOn = new Image();
imgWhoOn.src = "./images/" + imagePrefix + "_nav_who_ON.gif";

imgPortHover = new Image();      
imgPortHover.src = "./images/" + imagePrefix + "_nav_port_HOVER.gif";
imgPortOff = new Image(); 
imgPortOff.src = "./images/" + imagePrefix + "_nav_port_UP.gif";
imgPortOn = new Image();
imgPortOn.src = "./images/" + imagePrefix + "_nav_port_ON.gif";

imgClientsHover = new Image();      
imgClientsHover.src = "./images/" + imagePrefix + "_nav_clients_HOVER.gif";
imgClientsOff = new Image(); 
imgClientsOff.src = "./images/" + imagePrefix + "_nav_clients_UP.gif";
imgClientsOn = new Image();
imgClientsOn.src = "./images/" + imagePrefix + "_nav_clients_ON.gif";

imgEventsHover = new Image();      
imgEventsHover.src = "./images/" + imagePrefix + "_nav_events_HOVER.gif";
imgEventsOff = new Image(); 
imgEventsOff.src = "./images/" + imagePrefix + "_nav_events_UP.gif";
imgEventsOn = new Image();
imgEventsOn.src = "./images/" + imagePrefix + "_nav_events_ON.gif";

imgNewsHover = new Image();      
imgNewsHover.src = "./images/" + imagePrefix + "_nav_news_HOVER.gif";
imgNewsOff = new Image(); 
imgNewsOff.src = "./images/" + imagePrefix + "_nav_news_UP.gif";
imgNewsOn = new Image();
imgNewsOn.src = "./images/" + imagePrefix + "_nav_news_ON.gif";

imgContactHover = new Image();      
imgContactHover.src = "./images/" + imagePrefix + "_nav_contact_HOVER.gif";
imgContactOff = new Image(); 
imgContactOff.src = "./images/" + imagePrefix + "_nav_contact_UP.gif";
imgContactOn = new Image();
imgContactOn.src = "./images/" + imagePrefix + "_nav_contact_ON.gif";

// Function to 'activate' images.
function imgOn(imgName) {
       // if (document.images) {
       if (currentNav != imgName)
            document[imgName].src = eval(imgName + "Hover.src");
      //  }
}

// Function to 'deactivate' images.
function imgOff(imgName) {
        //if (document.images) {
        if (currentNav != imgName)
            document[imgName].src = eval(imgName + "Off.src");
       // }
}

// Turn on the nav image to show what page we are or what section we are in
function chooseNavImage() {
	var qs = queryString("nav");
	if (qs != "false")
		currentNav = qs;
		
	document[currentNav].src = eval(currentNav + "On.src");

}

//Query String parsing routines
function PageQuery(q) {
if(q.length > 1) this.q = q.substring(1, q.length);
else this.q = null;
this.keyValuePairs = new Array();
if(q) {
for(var i=0; i < this.q.split("&").length; i++) {
this.keyValuePairs[i] = this.q.split("&")[i];
}
}
this.getKeyValuePairs = function() { return this.keyValuePairs; }
this.getValue = function(s) {
for(var j=0; j < this.keyValuePairs.length; j++) {
if(this.keyValuePairs[j].split("=")[0] == s)
return this.keyValuePairs[j].split("=")[1];
}
return false;
}
this.getParameters = function() {
var a = new Array(this.getLength());
for(var j=0; j < this.keyValuePairs.length; j++) {
a[j] = this.keyValuePairs[j].split("=")[0];
}
return a;
}
this.getLength = function() { return this.keyValuePairs.length; } 
}
function queryString(key){
var page = new PageQuery(window.location.search); 
return unescape(page.getValue(key)); 
} 

