// Filename: rollover.js
// Project : Javascript Library
//
// Description:
// Simplified image rollover support that is platform independent and catches pre-NS3 capable
// browsers.
//
// Image rollovers are a two stage process.  
// 1) The images must be preloaded using the ROLLOVER_Preload function
// 2) Attach the ROLLOVER_Change to swap a preloaded image with the current image source
//
// Revision History:
// 03AUG2001 - MJT - Initial development.  Created for PSEC site

var	ROLLOVER_BrowserOK = false;

var	ROLLOVER_BrowserName = navigator.appName;
var ROLLOVER_BrowserVersion = parseInt( navigator.appVersion );

// determine if we are able to use rollovers based on the identification of the browser version
if ( ( ROLLOVER_BrowserName == "Netscape" && ROLLOVER_BrowserVersion >= 3 ) ||
	( ROLLOVER_BrowserName == "Microsoft Internet Explorer" && ROLLOVER_BrowserVersion >= 3 ) )
{
	ROLLOVER_BrowserOK = true;
}

// ROLLOVER_Preload
// Creates an image object that is preloaded to the desired image.  The function returns the
// image, which should be assigned to a variable.  For example:
// 		var imgMyRollover = ROLLOVER_Preload( "images/arrow.gif" );
// strImageSource: the path to the source of the image
// returns: the new image object
function ROLLOVER_Preload( strImageSource )
{
	var img;
	if ( ROLLOVER_BrowserOK )
	{
		img = new Image( );
		img.src = strImageSource;
	}
	return img;
}

// ROLLOVER_Change
// Changes the source of an image to the source of another preloaded image by the name of the
// image as a string.
// strImageName: name of the img tag to be changed
// strPreloadedImageName: name of the preloaded image object to use as the new picture.
// returns: nothing
function ROLLOVER_Change( strImageName, strPreloadedImageName )
{
	if ( ROLLOVER_BrowserOK )
	{
		document[ strImageName ].src = eval( strPreloadedImageName + ".src" );
	}
}
