// JavaScript Document for Preloading images (for rollovers and menu items)
// Edited by Nicholas Lee 
// Original from the original by Macromedia Corp.

// SHARED GLOBAL VARIABLES (These are used in this script but declared main HTML document)
// variable "preloadFlag"

// DOCUMENT PROPERTIES
// document.preloadArray  (Array of images to be preloaded)

// PRELOADING
function preloadImages() {
  var doc = document;

  if(doc.images) {
	if(!doc.preloadArray) doc.preloadArray = new Array(); // if an array for preloaded images does not exist, create one
	
	// start declare the needed local variables
    var index = null; // used for "for" statement below
	var nextArrayElem = doc.preloadArray.length; // used to find where to append items in the array
	var args = preloadImages.arguments; // the arguments of the function
	
	for(index = 0; index < args.length; index++) { // repeat with each of the arguments of the function
	  if(args[index]) {
		doc.preloadArray[nextArrayElem] = new Image(); // create new image object at end of array
		doc.preloadArray[nextArrayElem++].src = args[index]; // set the src in the array element and INCREASE nextArrayElem by 1 to get ready for next argument
	  }
	}
	  
	preloadFlag = true; // PRELOADFLAG VARIABLE IS DECLARED IN MAIN HTML DOCUMENT
  }
}
