/*	-----------------------------------------------------
	Copyright 2006 Paul Hansen / Ecopixel.com
	All Rights Reserved.

	Simple preloader for CSS images that can't be
	combined into a single graphic.
	----------------------------------------------------- */

//	CONFIGURATION

// Preload these hover images for CSS rollovers.
var images = new Array(
	'bg-navcrumbs-hover.gif',
	'bg-navcrumbs-left-hover.gif',
	'bg-navpage-hover.gif'
);

// Images are in this subdirectory.
var imageSubdir = 'img/';


// End of configuration.
//	-----------------------------------------------------

// Get the script URL.
// HOWTO: http://feather.elektrum.org/book/src.html
// (scripts don't know anything about how they were called; no $0).

var scripts = document.getElementsByTagName('script');
var index = scripts.length - 1;
var myScript = scripts[index]; // myScript now contains our script object

// Remove everything after the last / because that's our filename.

var imgBaseURL = myScript.src.substring(0, myScript.src.lastIndexOf('/') + 1) + imageSubdir;

// Loop over the images and preload them as Image objects.

for (var i in images) {
	var img = new Image();
	img.src = imgBaseURL + images[i];
}

