
/* **********************************************

Browser-independent image rollover manager
Written by Alan Bellows <hot_pastrami@yahoo.com>

NOTE: The file tools.js must be imported before 
this one, this file depends on some if its 
variables and functions.

Last Update: 08 May 2002

********************************************** */

var path = "images/";
var target ="kylafayemain";
var imageOnSuffix = "_on";
var imageOffSuffix = "_off";

var rolloverCounter = 0;


function Rollover (alt, imageBaseName, fileExt, url) {

	this.index = rolloverCounter;	
	this.imageOn = path + imageBaseName + imageOnSuffix + "." + fileExt;
	this.imageOff = path + imageBaseName + imageOffSuffix + "." + fileExt;
	this.alt = alt;
	this.url = url;
	this.write = writeRollover;

	var onImage = new Image();
	onImage.src = this.imageOn;

	var offImage = new Image();
	offImage.src = this.imageOff;

	rolloverCounter++;	
	this.write();
}


function writeRollover () {
	
	var html = "";
	var imageName = "rollover" + this.index;
	
	html+= "<a href=\"" + this.url + "\" onClick=\"this.blur()\" ";
	html+= "onMouseOver=\"window.status='" + this.alt + "';document.images['" + imageName + "'].src='"+ this.imageOn +"';return true;\" ";
	html+= "onMouseOut=\"window.status='';document.images['" + imageName + "'].src='"+ this.imageOff +"';return true;\" ";
	html+= "target='" + target + "'>";
	html+= "<img name=\"" + imageName + "\" border=\"0\" src=\""+ this.imageOff +"\" alt=\"" + this.alt + "\">";
	html+= "</a>";

	//alert(html);
	document.write(html);
}


//new Rollover("Alt Text", "filenamebase", "jpg", "http://somesite.com");
