// Alan Davis, adavis@ibota.com
// Copyright 2001 ibota, inc.  All rights reserved.

// preload mouseover img now which puts them in the browser's cache
// This is not in a function because it must occur before the page loads to
// prevent JavaScript errorr
if( typeof document.preloadArray == "undefined" ) {
	document.preloadArray = new Array();
}
if( document.images ) {
	with( document ) {
		preloadArray[0] = new Image; preloadArray[0].src = "../lib/ui/img/menu/about_y.gif";
		preloadArray[1] = new Image; preloadArray[1].src = "../lib/ui/img/menu/news_y.gif";
		preloadArray[2] = new Image; preloadArray[2].src = "../lib/ui/img/menu/clients_y.gif";
		preloadArray[3] = new Image; preloadArray[3].src = "../lib/ui/img/menu/partners_y.gif";
		preloadArray[4] = new Image; preloadArray[4].src = "../lib/ui/img/menu/employment_y.gif";
		preloadArray[5] = new Image; preloadArray[5].src = "../lib/ui/img/menu/ibotalogo_y.gif";
		preloadArray[6] = new Image; preloadArray[6].src = "../lib/ui/img/menu/home_y.gif";
		preloadArray[7] = new Image; preloadArray[7].src = "../lib/ui/img/menu/login_y.gif";
		preloadArray[8] = new Image; preloadArray[8].src = "../lib/ui/img/menu/contact_us_y.gif";
		preloadArray[9] = new Image; preloadArray[9].src = "../lib/ui/img/menu/hosted_sites_y.gif";
	}
}

// input:
//   document.<img name>
//   index into preloadArray of image to display
function image_on( imageObject, index ) {
	var obj = eval( imageObject ); // document.<img name>
	// Keep the current image to restore later during a mouseOut in imageOff
	document.restoreImage = obj.src;
	// display the image indicated by the given index into preloadArray
	if( obj != null ) {
		obj.src = document.preloadArray[index].src;
	}
}

// input:
//   document.<img name>
function image_off( imageObject ) {
	var obj = eval( imageObject ); // document.<img name>
	if( document.restoreImage != null )
		obj.src = document.restoreImage;
}
