/*
 * @File        $RCSfile: mouseover.js,v $
 * @Version     $Revision: 1.1 $
 * @Author      $Author: heeringa $ (last checked in by)
 * @Date        $Date: 2006/03/24 15:12:38 $ (UTC date of last check in)
 */

// Function Netscape: change image to ON.
function imageOnNS(e) {
	var oldSource = e.currentTarget.src;
	var newSource = oldSource.replace("_n.", "_o.");
	e.currentTarget.src = newSource;
}
// Function Internet Explorer: change image to ON.
function imageOnIE() {
	var oldSource = event.srcElement.src;
	var newSource = oldSource.replace("_n.", "_o.");
	event.srcElement.src = newSource;
}

// Function Netscape: change image to OFF.
function imageOffNS(e) {
	var oldSource = e.currentTarget.src;
	var newSource = oldSource.replace("_o.", "_n.");
	e.currentTarget.src = newSource;
}
// Function Internet Explorer: change image to ON.
function imageOffIE() {
	var oldSource = event.srcElement.src;
	var newSource = oldSource.replace("_o.", "_n.");
	event.srcElement.src = newSource;
}

// Function: scan images for ID.
var preloaded = new Array();
function setMOhandler() {
	var x = document.getElementsByTagName("img");
	for (var i = 0; i < x.length; i++) {
		if (x[i].id == "MO") {

			// Preload image with ID.
			var onImageSrc = x[i].src.replace("_n.", "_o.");
			preloaded[preloaded.length] = new Image();
			preloaded[preloaded.length-1].src = onImageSrc;

			// Define function for mouseOver/mouseOut
			// Netscape
			if (navigator.appName == "Netscape") {
				x[i].onmouseover = imageOnNS;
				x[i].onmouseout = imageOffNS;
			}
			// Internet Explorer
			else {
				x[i].onmouseover = imageOnIE;
				x[i].onmouseout = imageOffIE;
			}
		}
	}
}
