window.onload = rolloverInit;

function rolloverInit() {
	for (var i=0; i<document.images.length; i++) {
	if ( (imgParent=document.images[i].parentNode).tagName == "A" && imgParent.parentNode.id=='sidebarTop') {
			setupRollover(document.images[i]);
			}
		}
	}
function setupRollover(button) {
	button.outImage = new Image();
	button.outImage.src = button.src;
	button.onmouseout = rollOut;
	
	button.overImage = new Image();
	button.overImage.src = "images/buttons/" + button.id + "_on.png";
	button.onmouseover = rollOver;
	
	button.clickImage = new Image();
	button.clickImage.src = "images/buttons/" + button.id + "_press.png";
	button.onmousedown = rollClick;
	
	button.parentNode.childImage = button;
	button.parentNode.onblur = rollOutChild;
	button.parentNode.onfocus = rollOverChild;
}

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

function rollOver () {
	this.src = this.overImage.src;
}

function rollClick () {
	this.src = this.clickImage.src;
}

function rollOutChild () {
	this.childImg.src = this.childImg.outImage.src;
}

function rollOverChild () {
	this.childImg.src = this.childImg.overImage.src;
}

