Rollovers = new Object ();

Rollovers.initialize = function (key, dir, ovrPost, ext) {
	if (dir == "") dir = "./";
	else if (dir.charAt (dir.length - 1) != "/") dir += "/";
	
	for (var i = 0; i < document.images.length; i++) {
		var fNameSplit = (document.images [i].src).split ("/");
		var imgName = fNameSplit [fNameSplit.length - 1].split (".") [0];
		var imgExt = fNameSplit [fNameSplit.length - 1].split (".") [1];
		var imgDir = (fNameSplit.length > 1 ? fNameSplit [fNameSplit.length - 2] : ".") + "/";
		
		if (imgName.indexOf (key) == 0 && imgDir == dir && imgExt == ext) {
			var wkObj = new Object ();
			
			wkObj.ovr = new Image ();
			wkObj.ovr.src = dir + imgName + ovrPost + "." + ext;
			
			wkObj.out = new Image ();
			wkObj.out.src = document.images [i].src;
			
			Rollovers [imgName] = wkObj;
			
			document.images [i].name = imgName;
			document.images [i].onmouseover = new Function ("Rollovers.mouseOver (this);");
			document.images [i].onmouseout = new Function ("Rollovers.mouseOut (this);");
		}
	}
}

Rollovers.mouseOver = function (elm) {
	elm.src = Rollovers [elm.name].ovr.src;
}

Rollovers.mouseOut = function (elm) {
	elm.src = Rollovers [elm.name].out.src;
}

