// JavaScript Document
/*

Script by Leon van der Graaff // Jong Designs
leon@jongdesigns.nl

Script preloads images in a new way wich will work!

................

Example

imgArr = new Array('image1.png', 'image2.gif');
dir = "../afbeeldingen/background"

preloadImages(imgArr);

.................

place script totally at the bottom of your page!! (just before </body>)

*/
function preloadImages(imgArr, dir){
		
	div = new Array();
	
	for(key in imgArr){
		
		if(typeof(imgArr[key]) != "string"){
			continue;
		}
	
		div[key] = document.createElement("div");
		div[key].style.backgroundPosition = "-9999px";
		div[key].style.backgroundRepeat = "no-repeat";
		div[key].style.backgroundImage = "url(\"" + dir + imgArr[key] + "\")";
		
		document.body.appendChild(div[key]);
	}
}
