/*-------------------------------------------------------------------------------------------------------------
 *
 * File:		preload.js
 * Author:		Peter Quinn
 * Date:		13.09.2007
 * Description:	Preloads images for mouseovers
 *
 * Usage:		
 *
 *-----------------------------------------------------------------------------------------------------------*/


/*-------------------------------------------------------------------------------------------------------------
 * Preload Class
 *
 */
function Preload( list )
{
	this.image		= new Array;
	
	
	/**
	 * Loads in a list of images
	 *
	 * @param array list List of image names & URL's
	 */
	this.load = function( list )
	{
		for( var i in list )
		{
			this.image[i] = new Image;
			this.image[i].src = list[i];
		}
	}
	
	/**
	 * Returns the source of a preloaded image
	 *
	 * @param string name Image name
	 * @return Returns an images' source
	 */
	this.get = function( name )
	{
		return this.image[name].src;
	}
	
	
	// if a list was passed to the constructor then process it
	if ( list )
		this.load( list );
}


/*-----------------------------------------------------------------------------------------------------------*/
