//
// JavaScript Document
// RollOver by laplima
//
// For each image (e.g. "bt.png") inside a <a> tag there must exist
// a corresponding image (e.g. "bt-over.png") inside the same directory
// (the specific extension doesn't matter).
//

function rolloverInit() {
	for (var i=0; i<document.images.length; i++) {
		var img = document.images[i];
		if (img.parentNode.tagName == "A" && img.className == "rollover")
			setupRollover(img);
	}
}

function setupRollover(thisImage) {
	var source = thisImage.src;
	var ext = source.substr(source.length-4);	// e.g. ".png"

	thisImage.outimg = new Image;
	thisImage.outimg.src = source;
	thisImage.onmouseout = rollout;
	
	thisImage.overimg = new Image;
	thisImage.overimg.src = source.replace(ext,"-over"+ext);
	thisImage.onmouseover = rollover;
}

function rollout() {
	this.src = this.outimg.src;
}

function rollover() {
	this.src = this.overimg.src;
}

