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.onmouseup = rollUp;   
	
	thisImage.clickImage = new Image();
	thisImage.overImage = new Image();

	/*alert(thisImage.src.length);*/
	var lgth=thisImage.src.length;
	var path = thisImage.src.substring(0,lgth-4);
	var ext = thisImage.src.substring(lgth-4,lgth);
	/*alert(path);
	alert(ext);*/
	thisImage.clickImage.src = path + "_click" + ext;
	thisImage.overImage.src = path + "_on" + ext;
    /*alert(thisImage.overImage.src);
	alert(thisImage.clickImage.src);*/
	
	
	thisImage.onmousedown = rollClick;
	
	
	thisImage.onmouseover = rollOver; 
}	


function rollOver() {
	this.src = this.overImage.src;
}

function rollOut() {
	this.src = this.outImage.src;
}

function rollClick() {
	this.src = this.clickImage.src;
}
function rollUp() {
    this.src = this.outImage.src;
}


