//**********************************************
//
// Generic Rollover 1.1
// Description:
//
// Usage:
// Call roAutoLoad() on body onload.
// Name all your images that you want to include in the rollover object with a prefix defined in the
// ROLLOVER_PREFIX constant. Add an <a href> tag around the image and add
//	onmouseover=roOver(PREFIX + n) onmouseover=roOver(PREFIX + n)  with the coresponding name of the image.
// Sample:
// <a href="#" onmouseover="roOver('ro1')" onmouseout="roOut('ro1')">
//			<img border="0" name="ro1" src="images/my_button_off.gif"></a>
//
// include all valid rollover pairs to the aRO_validSuffix array.
//***********************************************

var aImages 	= new Array();
var ROLLOVER_PREFIX	= 'ro';
validSuffix = new Array();
var idx = 0;
validSuffix[idx++] = new Array("_off","_on");
validSuffix[idx++] = new Array("_on","_on");

function roObject(imgName) {
	this.out = new Image();
	this.out.src = document.images[imgName].src;
	this.over = new Image();
	this.over.src == this.out.src;
	for (var i=0;i<validSuffix.length;i++) {
        var re = new RegExp (validSuffix[i][0] +"(.(gif|jpg|jpeg))");
		if (this.out.src.match(re) != null) {
			this.over.src = this.out.src.replace (re, "" + validSuffix[i][1] + "$1");
			break;
		}
	}
}

function roOut(imgName) {
	if (aImages[imgName] == null) {
		roLoad(imgName);
	}
	if (document.images && aImages[imgName] != null)
		document.images[imgName].src = aImages[imgName].out.src;
}

function roOver(imgName) {
	if (aImages[imgName] == null) {
		roLoad(imgName);
	}
	if (document.images && aImages[imgName] != null){
		document.images[imgName].src = aImages[imgName].over.src;
	}
}

function roLoad(imgName) {
	if (document.images) {
		if (document.images[imgName] != null)
    			aImages[imgName] = new roObject(imgName);
	}
}

function roAutoLoad() {

	if (document.all) {
		if (document.readyState != "complete") {
			setTimeout("roAutoLoad()",50);
		}
	}		
	
	if (document.images) {
  		for (var i=0; i < document.images.length; i++) {
			if (document.images[i].name.substr(0, ROLLOVER_PREFIX.length) == ROLLOVER_PREFIX) {
				roLoad(document.images[i].name);
			}
  		}
	}
}