
/* Last Modified $Date: 12/14/05 6:19p $ by $Author: Rsterner $ (Version history stored in Source Control) */

// set up browser detect vars
var isNS4 = (navigator.appName.indexOf("Netscape") != -1 && navigator.appVersion.charAt(0) == "4");
var isMOZ = (navigator.appName.indexOf("Netscape") != -1 && parseInt(navigator.appVersion.charAt(0)) >= 5);
var isIE = (navigator.appName.indexOf("Microsoft") != -1);
var browserVersion = parseInt(navigator.appVersion.charAt(0));
if (isIE) {
    temp = navigator.appVersion.split("MSIE")
    browserVersion = parseFloat(temp[1])
}
//alert("isNS4 = " + isNS4 + "\nisMoz = " + isMOZ + "\nisIE = " + isIE + "\nbrowserVersion = " + browserVersion);

var baseURL = "/";

/*
 * This function highlights an image
 *
 * @param	image - the name of the image to be flipped
 * @param	dir - path to image dir (ex: "../images/nav/")
 * @param	imgName - optional, if name attribute is different from the image file name
 */
function over(image, dir, imgName) { 
	if (document.images) {
		var img = (imgName) ? findObject(imgName) : findObject(image);
		// store reference to old image for the out function
		img.rsrc = img.src;
		img.src = dir + image + "_on.gif";
	}
}

/**
 * This function restores an image
 *
 * @param	image - the name of the image to be flopped
 * @param	imgName - optional, if name attribute is different from the image file name
 */
function out(image) {
	if (document.images) {
		var img = findObject(image);
		// set source to stored reference to the old image
		img.src = img.rsrc;
	}
}

function preload(list, dir, suffix) {
    if (document.images) {
		// image object array
		var imgs = new Array();
		// loop through list
		for (i=0; i < list.length; i++) {
			imgs[i] = new Image();
			imgs[i].src = dir + list[i] + suffix;
		}
	}
}

// adapted from MM_findObj
function findObject(name, doc) {

	// get document, if it hasn't been passed
	if (!doc) doc = document;

	// declare object reference
	var obj = null;

	// check document and document.all collections	
	if (!(obj = doc[name]) && doc.all) {
		obj = doc.all[name];
	}
	
	// check document.layers collection
	if (!obj && document.layers) {
		for (var i = 0; !obj && i < doc.layers.length; i++) {	
			obj = findObject(name, doc.layers[i].document);
		}
	}
		
	if (!obj && doc.getElementById) {
		obj = doc.getElementById(name);
	}
	
	return obj;
}

