var PRELOAD_IMAGES = false;

/**
 * Create new image.
 * Create a new image within the document that's being loaded.
 * @public
 * @param	arg		Image location on the server.
 * @return	string
 */
function newImg (arg) 
{
	if (document.images) 
	{
		rslt		= new Image();
		rslt.src	= arg;
		return rslt;
	}

}

/**
 * Change image.
 * When an image is rolled over, use this function to change it.
 * @public
 * @return	void
 */
function chgImg () 
{
	if (document.images && (PRELOAD_IMAGES == true)) 
	{
		for (var i=0; i < chgImg.arguments.length; i+=2) 
		{
			document[chgImg.arguments[i]].src = chgImg.arguments[i+1];
		}
	}

}

/**
 * Preload images.
 * When a page loads up, ensure that the images being shown as the rollover states
 * get preloaded so they are quick to be displayed.
 * @public
 * @return	void
 */
function preloadImages () 
{
	if (document.images) 
	{

		home_over					= newImg ("/images/nav/global/on/home.jpg");
		the_coffee_shop_over		= newImg ("/images/nav/global/on/the_coffee_shop.jpg");
		all_about_coffee_over		= newImg ("/images/nav/global/on/all_about_coffee.jpg");
		about_the_merchants_over	= newImg ("/images/nav/global/on/about_the_merchants.jpg");
		news_and_comm_over			= newImg ("/images/nav/global/on/news_and_comm.jpg");
		contact_us_over				= newImg ("/images/nav/global/on/contact_us.jpg");
	
		PRELOAD_IMAGES = true;

	}

}
