window.onload = rolloverInit;

function rolloverInit() {
	for (var i=0; i<document.images.length; i++) {
		switch(document.images[i].parentNode.tagName){
			case "A":
				setupRollover(document.images[i]);
				break;
			case "SPAN":
				setupPNGRollOver(document.images[i]);
				break;
			default:
				break;
		}
	}
}

function setupPNGRollOver(thisImage){
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	thisImage.onmouseout = rollOut;

	thisImage.overImage = new Image();
	thisImage.overImage.src = "../images/" + thisImage.id + "-on.png";
	thisImage.onmouseover = rollOver;
}

function setupRollover(thisImage) {
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	thisImage.onmouseout = rollOut;

	thisImage.overImage = new Image();
	thisImage.overImage.src = "../images/" + thisImage.id + "-on.jpg";
	thisImage.onmouseover = rollOver;
	
	thisImage.clickImage = new Image();
	thisImage.clickImage.src = "../images/" + thisImage.id + "-Big.jpg";
	thisImage.onclick = rollClick;
}

function rollOut() {
	this.src = this.outImage.src;
}

function rollOver() {
	this.src = this.overImage.src;
}

function rollClick(){
	for(i=1;i<7;i++){
		switch(this.id){
			case "stockStrip1-" + i:
				document.getElementById("bigIMG-1").src = this.clickImage.src;
				break;
			case "stockStrip2-" + i:
				document.getElementById("bigIMG-2").src = this.clickImage.src;
				break;
			case "stockStrip3-" + i:
				document.getElementById("bigIMG-3").src = this.clickImage.src;
				break;
			case "stockStrip4-" + i:
				document.getElementById("bigIMG-4").src = this.clickImage.src;
				break;
			default:
				break;
		}
	}
	return false;
}


