// Common Javascript Functions Library v1.0 //

var defaultStatusMessage = "Default Message";

var NS = (!document.getElementById && document.layers)?1:0;

var IE = (document.getElementById)?1:0;



// Image Object Builder Script

// Set these variables with the required settings.

// Names of all the rollover images go in this array

var imageList = new Array("home","corporate","projects","asx","media","contact");



// The first part of the actual image file names

var imageNamePrefix = "../images/b_nav_";



// What format the images are saved in, .gif, .jpg or .png

var imageFormat = ".gif";



function createImages() {

	for (i=0; i<imageList.length; i++) {

		// creates the normal state images

		temp = imageList[i] + "n";

		eval(temp + " = returnImage(imageList[i])");



		// creates the rollover stage images

		temp2 = imageList[i] + "a";

		eval(temp2 + " = returnImage(imageList[i] + '_o')");

	}

}



// creates the actual image object and assigns the SRC to it

// then hands it back to the main function.

function returnImage(imageName) {

	temp = new Image();

	temp.src = imageNamePrefix + imageName + imageFormat;

	return temp;

}



// image rollover functions

function roll(imageToChange, state) {

//	if (IE) { //all this commented code is only needed if rollovers are inside a div

		if (state) {

			document.images[imageToChange].src = eval(imageToChange + "a").src;

		} else {

			document.images[imageToChange].src = eval(imageToChange + "n").src;

		}

//	} else if (NS) { //all this commented code is only needed if rollovers are inside a div

//		if (state) {

//			document.header.document.images[imageToChange].src = eval(imageToChange + "a").src;

//		} else {

//			document.header.document.images[imageToChange].src = eval(imageToChange + "n").src;

//		}

//	}

}



// set the status bar message

function setStatus(state, message) {

	if (state) {

		window.status = message;

	} else {

		window.status = defaultStatusMessage;

	}

}



// open a normal window

function openWindow(linky, name) {

	tempWindowHolderVariableThingy = window.open(linky.href, name, "location,menubar,resizable,scrollbars,status,toolbar");

	tempWindowHolderVariableThingy.focus();

}



// open a sized window

function openSizedWindow(linky, name, windowHeight, windowWidth) {

	tempWindowHolderVariableThingy = window.open(linky.href, name, "location,menubar,resizable,scrollbars,status,toolbar,height=" + windowHeight + ",width=" + windowWidth);

	tempWindowHolderVariableThingy.focus();

}



function loadPopupImage(imgHeight, imgWidth) {

	var imageToLoad = location.search;

	var imageToLoad = imageToLoad.slice(1,imageToLoad.length);

	return '<IMG SRC="images/'+ imageToLoad +'" WIDTH="'+ imgWidth +'" HEIGHT="'+ imgHeight +'" ALT="" BORDER="0">';

}



// Netscape 4 window resize fix

if (NS) {

	window.onresize = NSreloader;

	var winWidth = window.innerWidth;

	var winHeight = window.outerHeight;

}



function NSreloader(NSevent) {

	if (winWidth!=NSevent.width && winHeight!=NSevent.height) {

		location.reload();

	}

}



// code that is run ones the document is loaded

window.status = defaultStatusMessage;

createImages();



//EoF