// JavaScript Document
window.onload = rolloverInit;

var currentpic = 0;
var otherpic = 1;
var bigImages = new Array(2);

function rolloverInit () {
	for (var i=0; i < document.images.length; i++) {
		if (document.images[i].name == "rollover") {
			setupRollover(document.images[i]);
		} else if (document.images[i].name == "bigimage") {
			bigImages[currentpic] = document.images[i];
			currentpic = currentpic + 1;
		}
	}
	
	currentpic = 0;
	otherpic = 1;
}

function setupRollover(thisImage) {
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	//thisImage.onmouseout = rollOut;
	
	thisImage.overImage = new Image();
	thisImage.overImage.src = "http://www.dsrecordings.com/seodesign/images/studio/" + thisImage.id + ".jpg";
	thisImage.overImage.alt = thisImage.alt;
	thisImage.onmouseover = rollOver;
}

function rollOver() {	
	if (bigImages[currentpic].src != this.overImage.src &&
		bigImages[otherpic].src != this.overImage.src) {
		bigImages[currentpic].src = this.overImage.src;
		bigImages[currentpic].alt = this.overImage.alt;
	
		if (currentpic == 0) {
			currentpic = 1;
			otherpic = 0;
		} else {
			currentpic = 0;
			otherpic = 1;
		}
	}
}

function rollOut() {
	this.src = this.outImage.src;
}