;function preload(picData,config){if(!picData)return;var initConfig={handleFileLoad:function(){},handleComplete:function(){},handleError:function(){}};config=config||{};this.config=this.extend(config,initConfig,false);this.picData=picData;this.init();};preload.prototype={init:function(){var _this=this;var config=_this.config;var picData=_this.picData;var total=picData.length;var loaded=0;var errored=0;function handle(obj,type){var para={};para.total=total;para.loaded=loaded;para.errored=errored;para.progress=(loaded+errored)/total;para.percent=parseInt(para.progress*100)+"%";if(type=="load"||type=="complete"){if(config.handleFileLoad&&typeof(config.handleFileLoad)=="function"){config.handleFileLoad(obj,para);};}else if(type=="error"||type=="abort"){if(config.handleError&&typeof(config.handleError)=="function"){config.handleError(obj,para);};}
if(para.progress==1){if(config.handleComplete&&typeof(config.handleComplete)=="function"){config.handleComplete(obj,para);};};obj=obj.onabort=obj.onload=obj.onerror=null;}
for(var i=0;i<picData.length;i++){(function(m){var img=new Image();img.src=picData[m];if(img.complete){loaded++;handle(img,"complete");return;};img.onload=function(){loaded++;handle(img,"load");}
img.onabort=function(){errored++;handle(img,"abort");}
img.onerror=function(){errored++;handle(img,"error");}})(i)};},extend:function(destination,source,override,replacer){if(override===undefined)override=true;for(var property in source){if(override||!(property in destination)){if(replacer)replacer(property);else destination[property]=source[property];}}
return destination;}};