// This is the main JavaScript file

window.onload = initAll

// Functions to initialize
function initAll() {
	// Turn on auto rover detect
	//enableRollOver();
}

// Function to initialize roll overs
function enableRollOver() {
	for(var i=0;i<document.images.length;i++) {
		if(document.images[i].parentNode.tagName == "A") {
			setupRollOver(document.images[i]);
		}
	}
			
}

// Functon to setup roll overs
// NOTE: rewrite script so it can take any image extension instead of just .png
function setupRollOver(thisImage) {
	// Setup the off image
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	thisImage.onmouseout = onOut;
	// Setup the on image
	thisImage.overImage = new Image();
	thisImage.overImage.src = "Images/" + thisImage.id + "_on.png";
	thisImage.onmouseover = onOver;
	// Setup the click image
	thisImage.downImage = new Image();
	thisImage.downImage.src = "Images/" + thisImage.id + "_down.png";
	thisImage.onmousedown= onDown;
}
	
// Functions to do for roll overs
function onOut() {this.src = this.outImage.src;}
function onOver() {this.src = this.overImage.src;}
function onDown() {this.src = this.downImage.src;}

