// JavaScript 1.5 Document

//If JavaScript does not have this function then add it
if (!Array.prototype.forEach)
{
  Array.prototype.forEach = function(fun /*, thisp*/)
  {
	var len = this.length;
	if (typeof fun != "function")
	  throw new TypeError();

	var thisp = arguments[1];
	for (var i = 0; i < len; i++)
	{
	  if (i in this)
		fun.call(thisp, this[i], i, this);
	}
  };
}

//Function to preload each element in a array
function preloadImagesInArray(element, index, array) {
	var tempImgObj = new Image();
	tempImgObj.src = element;
}

/* USAGE
var imagesToPreload = new Array();
imagesToPreload[] = "images/image1.gif";
imagesToPreload[] = "images/image2.gif";
//imagesToPreload[] = "";

//preload each element in the array
imagesToPreload.forEach(preloadImagesInArray);
*/