/*
	Preloads rollover images into browser's cache at runtime.

	UPDATE 20/11/2008 11:42 PM: Added sidebar backgrounds for smoother
	page navigation. Moved script's execution to end at page to reduce
	lag with loading rest of page's contents.
*/

function preloadImages(imgDirectory)
{	
	var imgCount 		= 10;
	var imgPrefix 		= "a_stone";
	var imgSuffix 		= "_hover";
	var imgFormat 		= "png";

	imageBackgrounds = new Array();
	imageBackgrounds[0] = "b_sidebar_company.png";
	imageBackgrounds[1] = "b_sidebar_services.png";
	imageBackgrounds[2] = "b_sidebar_people.png";
	imageBackgrounds[3] = "b_sidebar_contact.png";

	var imgSrc 			= new String();
	document.imageArray = new Array(imgCount);
	for(i = 1; i < imgCount; i++)
	{
		if(i < 6)	{imgSrc = imgDirectory+imgPrefix+[i]+imgSuffix+"."+imgFormat;}
		else		{imgSrc = imgDirectory+imageBackgrounds[i-6];}

		document.imageArray[i] = new Image;
		document.imageArray[i].src = imgSrc;
	}
}
