/*------------------------------------------------------------------------------------ 	Preloader	A very simple image preloader object   	Usage: 	    Preloader.add(path);    Preloader.onFinish(func);    Preloader.load();          path: 		A string or array of strings of image paths to preload      func:     A function or array of functions to be called after images are loaded      load():   Start the preloader      ------------------------------------------------------------------------------------*/var callbacks = [];var images = [];var loadedImages = [];var imagesLoaded = 0;  function addimage(image)	{    if (typeof image == 'string') this.images.push(image);    if (typeof image == 'array' || typeof image == 'object')		{      	for (var i=0; i< image.length; i++)	  		{        	this.images.push(image[i]);      		}    	}  	}	function onFinish(func)	{    if (typeof func == 'function') this.callbacks.push(func);    if (typeof func == 'array' || typeof func == 'object')		{      	for (var i=0; i< func.length; i++)			{        	this.callbacks.push(func[i]);      		}   		 }  	}		function loadimages()	{    for(var i=0; i<this.images.length; i++)		{      	this.loadedImages[i] = new Image();      	this.loadedImages[i].onload = function()			{			checkFinished.apply()			}     	this.loadedImages[i].src = this.images[i];    	}	}  function checkFinished()	{    this.imagesLoaded++;    if (this.imagesLoaded < this.images.length)		{		document.getElementById('preloadcount').innerHTML = 'Loading image ' + imagesLoaded + ' of ' + (this.images.length - 1);		}    if (this.imagesLoaded == this.images.length)		{		this.fireFinish();		}	}	function fireFinish()	{    for (var i=0; i<this.callbacks.length; i++)		{		this.callbacks[i]();		}    this.images = [];    this.loadedImages = [];    this.imagesLoaded = 0;    this.callbacks = [];	}