(function(a){var d={timeout:5000};var c=function(h,g){var f=Array.prototype.slice.call(arguments);f=f.slice(2);if(typeof h=="function"){return h.apply(g||this,f)}};var e=function(g,h){var f=this;if(g.src){f.aborted++;return}g.onload=function(){g.onerror=g.onload=g.onabort=null;f.loaded++;c(f.config.onLoad,f);f.next()};g.onerror=function(){f.error++;c(f.config.onError,f)};g.onabort=function(){f.aborted++;c(f.config.onAbort,f)};f.timer=setTimeout(function(){g.src="";f.timeout++;g.onerror=g.onload=g.onabort=null;c(f.config.onTimeout,f,g)},this.config.timeout);g.src=h};a.imgLoader=function(g,f){this.config=f||d;this.toload=g||[];this.total=this.toload.length;this.loaded=this.processed=0;this.error=this.aborted=this.timeout=0;c(this.config.onInit,this)};var b=a.imgLoader.prototype;b.load=function(){if(this.stopLoad){return}this.current=this.toload.shift();if(this.current&&this.processed<=this.total){this.processed++;e.call(this,this.current.img,this.current.addr)}else{c(this.config.onComplete,this)}};b.stop=function(f){clearTimeout(this.timer);if(f){this.stopLoad=true}};b.start=function(){this.load()};b.next=function(){this.stop();this.start()}})(window);
