window.onload = rolloverInit;

function rolloverInit() {
	for(var i = 0; i < document.images.length; i++) {
		if(document.images[i].parentNode.tagName == 'A') {
			setupRollOver(document.images[i]);
		}
	}
}

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 + '_over.jpg';
	thisImage.onmouseover = rollOver;
	
	thisImage.parentNode.childImage = thisImage;
	thisImage.parentNode.onfocus = rollFocus;
	thisImage.parentNode.onblur = rollBlur;
}

function rollOut() {
	this.src = this.outImage.src;
}

function rollOver() {
	this.src = this.overImage.src;
}
		
function rollClick() {
	this.src = this.clickImage.src;
}

function rollFocus() {
	this.childImage.src = this.childImage.overImage.src;
}

function rollBlur() {
	this.childImage.src = this.childImage.outImage.src;
}
