
function imagePreloader(playlist){this.image_loader=Array();this.playlist=playlist;this.currentPosition=0;this.i=0;this.triggers=Array();this.loadNext=function(){this.preloadImage();}
this.preloadImage=function(){this.image_loader[this.parent.currentPosition]=document.createElement('img');this.image_loader[this.parent.currentPosition].num=this.parent.currentPosition;this.loadComplete_X=-1;this.image_loader[this.parent.currentPosition].parent=this.parent;this.image_loader[this.parent.currentPosition].onload=function(){this.loadComplete_X=1;if(this.parent.triggers[this.num]){eval(this.parent.triggers[this.num]);}
this.parent.currentPosition++;if(this.num>=(this.parent.playlist.length-1)){this.parent.complete();return;}else{this.parent.loadNext();}}
this.image_loader[this.parent.currentPosition].src=this.playlist[this.parent.currentPosition];}
this.setTrigger=function(index,func){this.triggers[index]=func;}
this.isLoaded=function(index){if(index>(this.playlist.length-1))return false;if(index>(this.image_loader.length-1))return false;return this.image_loader[index].loadComplete_X;}
this.getImage=function(index){return this.image_loader[index];}
this.complete=function(){}
this.init=function(){this.preloadImage();}
return this;}