window.onload = rolloverInit;

function rolloverInit() {
	for (var i=0; i<document.images.length; i++) {
			if (document.images[i].parentNode.className == "gif") {
				setupRolloverGif(document.images[i]);
				} else {
					if (document.images[i].parentNode.className == "jpg") {
			setupRolloverJpg(document.images[i]);
			}
	}
}
}

function setupRolloverGif(thisImage) {
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	thisImage.onmouseout = function() {
		this.src = this.outImage.src;
	}

	thisImage.overImage = new Image();
	thisImage.overImage.src = "images/" + thisImage.id + "-over.gif";
	thisImage.onmouseover = function() {
		this.src = this.overImage.src;
	}
}

function setupRolloverJpg(thisImage) {
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	thisImage.onmouseout = function() {
		this.src = this.outImage.src;
	}

	thisImage.overImage = new Image();
	thisImage.overImage.src = "images/" + thisImage.id + "-over.jpg";
	thisImage.onmouseover = function() {
		this.src = this.overImage.src;
	}
}

