/**
 * This function pre-loads images
 * @name 	preload
 * @param	list - comma-separated string of named images on the page, set by and passed in from the calling page
 * @param	path - string containing the relative path to the directory (ex: "../images/home/")
 */
function preload(list, path) {
	if (document.images) {
		var preloadImages = list.split(",");
		var images = new Array();
		for (i=0; i < preloadImages.length; i++) {
			if (preloadImages[i] != "") {
				images[i] = new Image();
				images[i].src = path + preloadImages[i] + "_on.gif";
			}
		}
	}
}


/*
 * This function highlights an image
 * @name	over
 * @param	image - the toolbar image to be flipped
 * @param	path - string containing the relative path to the directory (ex: "../images/home/")
 * @param	imgName - optional, the name of the image object on the page (otherwise assumed to be image)
 */
function over(image, path, imgName) {  
	if (document.images) {
		var img = (imgName) ? document.images[imgName] : document.images[image];
		// store reference to old image for the out function
		img.rsrc = img.src;
		img.src = path + image + "_on.gif";
	}
}


/**
 * This function restores an image
 * @name	out
 * @param	image - the toolbar image to be flopped
 * @param	imgName - optional, the name of the image object on the page (otherwise assumed to be image)
 */
function out(image, imgName) {
	if (document.images) {
		var img = (imgName) ? document.images[imgName] : document.images[image];
		// set source to stored reference to the old image
		img.src = img.rsrc;
	}
}
