/**
 * @author Digital - Jaffro Image PreLoader 02/2009
 * @see jquery
 *
 * Preload Images from a defined array - preLoadImgFrmArray(array);
 * Preload images from img tags - preLoadImgFrmElement(element);
 *
 */

jQuery.preloadImages = function(){ // sets jquery standard function.
	if ($.browser.version < 7 && $.browser.msie){
		//--------------------------------------------------------------------------- Start of IE Only Code
		
		$("#navigationHolder img").each(function(){
			$(this).replaceWith("<span class=\"inlineSet "+$(this).attr("class")+
					"\" id=\""+$(this).attr("id")+"\" style=\"width: "
					+$(this).width+"; height:"+$(this).height+"\"></span>");
		});
		
		//--------------------------------------------------------------------------- End of IE Only Code
	} else {
		for( var i=0; i<arguments.length; i++){
			jQuery("<img>").attr("src", arguments[i]); // Args = image locations.
		}
	}
};

function preLoadImgFrmArray(imageArray){
	/**
	 * Preload images into a page from an array listing the image locations (src/url)
	 * @author Jaffro
	 * @param {array} imageArray The array listing image locations.
	 * 
	 */
	var i;
	for (i in imageArray){
		$.preloadImages(imageArray[i]);
	}
}
