var isReady = false;	/* set to 'true' once page has loaded */

function Rollover() {
	this.Images = new Object();
}
	
function init() {
	oDoc = document;
	this.findImages(oDoc);
	if (document.layers) {
		for (m=0; m < document.layers.length; m++) {
			oDoc1 = document.layers[m].document;
			this.findImages(oDoc1);
			for (n=0; n < oDoc1.layers.length; n++) {
				oDoc2 = oDoc1.layers[n].document;
				this.findImages(oDoc2);
			}
		}
	}
}
	
function findImages(doc) {
	for (i=0; i < doc.images.length; i++) {
		img = doc.images[i];
		if (img.name) {
			this.addImage(img);
		}
	}
}

function addImage(img) {
	lastSlash = img.src.lastIndexOf("/");
	if(lastSlash < 0) lastSlash = 0;
	
	lastDot = img.src.lastIndexOf(".");
	if(lastDot < 0) lastDot = img.src.length;
	
	imgLoc = (lastSlash > 0) ? img.src.substring(0, lastSlash + 1) : new String("");
	baseName = img.src.substring(lastSlash + 1, lastDot);
	ext = img.src.substring(lastDot, img.src.length);
	
	img.off = new Image();
	img.off.src = img.src;
	img.on = new Image();
	img.on.src = imgLoc + baseName + "_on" + ext;
	
	this.Images[img.name] = img;
}
	
function on(imgName) {
	
		if (this.Images[imgName] && isReady) this.Images[imgName].src = this.Images[imgName].on.src;
						}


function off(imgName) {
//alert(imgName)
	if(imgName!=local){
		if (this.Images[imgName] && isReady) this.Images[imgName].src = this.Images[imgName].off.src;}
}		

Rollover.prototype.init = init;
Rollover.prototype.on = on;
Rollover.prototype.off = off;
Rollover.prototype.findImages = findImages;
Rollover.prototype.addImage = addImage;