/*! PxLoader v1.0.0 | http://thinkpixellab.com/PxLoader */ function PxLoaderImage(a,b,c,d){var e=this,f=null;this.img=new Image,void 0!==d&&(this.img.crossOrigin=d),this.tags=b,this.priority=c;var g=function(){"complete"===e.img.readyState&&(j(),f.onLoad(e))},h=function(){j(),f.onLoad(e)},i=function(){j(),f.onError(e)},j=function(){e.unbind("load",h),e.unbind("readystatechange",g),e.unbind("error",i)};this.start=function(b){f=b,e.bind("load",h),e.bind("readystatechange",g),e.bind("error",i),e.img.src=a},this.checkStatus=function(){e.img.complete&&(j(),f.onLoad(e))},this.onTimeout=function(){j(),e.img.complete?f.onLoad(e):f.onTimeout(e)},this.getName=function(){return a},this.bind=function(a,b){e.img.addEventListener?e.img.addEventListener(a,b,!1):e.img.attachEvent&&e.img.attachEvent("on"+a,b)},this.unbind=function(a,b){e.img.removeEventListener?e.img.removeEventListener(a,b,!1):e.img.detachEvent&&e.img.detachEvent("on"+a,b)}}function PxLoaderSound(a,b,c,d){var e=this,f=null,g=navigator.userAgent.match(/(ipad|iphone|ipod)/i),h=navigator.userAgent.match(/android/i);this.useGlobalHTML5Audio=g||h,this.tags=c,this.priority=d,this.sound=soundManager.createSound({id:a,url:b,autoLoad:!1,onload:function(){f.onLoad(e)},onsuspend:function(){f.onTimeout(e)},whileloading:function(){var a=this.bytesLoaded,b=this.bytesTotal;a>0&&a===b&&f.onLoad(e)}}),this.start=function(a){f=a,this.useGlobalHTML5Audio?f.onTimeout(e):this.sound.load()},this.checkStatus=function(){switch(e.sound.readyState){case 0:break;case 1:break;case 2:f.onError(e);break;case 3:f.onLoad(e)}},this.onTimeout=function(){f.onTimeout(e)},this.getName=function(){return b}}function PxLoaderVideo(a,b,c,d){var e=this,f=null;this.readyEventName="canplaythrough";try{this.vid=new Video}catch(g){this.vid=document.createElement("video")}void 0!==d&&(this.img.crossOrigin=d),this.tags=b,this.priority=c;var h=function(){4===e.vid.readyState&&(k(),f.onLoad(e))},i=function(){k(),f.onLoad(e)},j=function(){k(),f.onError(e)},k=function(){e.unbind("load",i),e.unbind(e.readyEventName,h),e.unbind("error",j)};this.start=function(b){f=b,e.bind("load",i),e.bind(e.readyEventName,h),e.bind("error",j),e.bind("suspend",i),e.vid.src=a,e.vid.load()},this.checkStatus=function(){4===e.vid.readyState&&(k(),f.onLoad(e))},this.onTimeout=function(){k(),4!==e.vid.readyState?f.onLoad(e):f.onTimeout(e)},this.getName=function(){return a},this.bind=function(a,b){e.vid.addEventListener?e.vid.addEventListener(a,b,!1):e.vid.attachEvent&&e.vid.attachEvent("on"+a,b)},this.unbind=function(a,b){e.vid.removeEventListener?e.vid.removeEventListener(a,b,!1):e.vid.detachEvent&&e.vid.detachEvent("on"+a,b)}}!function(a){function b(a){a=a||{},this.settings=a,null==a.statusInterval&&(a.statusInterval=5e3),null==a.loggingDelay&&(a.loggingDelay=2e4),null==a.noProgressTimeout&&(a.noProgressTimeout=1/0);var b,d=[],e=[],f=Date.now(),g={QUEUED:0,WAITING:1,LOADED:2,ERROR:3,TIMEOUT:4},h=function(a){return null==a?[]:Array.isArray(a)?a:[a]};this.add=function(a){a.tags=new c(a.tags),null==a.priority&&(a.priority=1/0),d.push({resource:a,status:g.QUEUED})},this.addProgressListener=function(a,b){e.push({callback:a,tags:new c(b)})},this.addCompletionListener=function(a,b){e.push({tags:new c(b),callback:function(b){b.completedCount===b.totalCount&&a(b)}})};var i=function(a){a=h(a);var b=function(b){for(var c=b.resource,d=1/0,e=0;ef&&(d=f,0===d))&&0!==d;f++);return d};return function(a,c){var d=b(a),e=b(c);return e>d?-1:d>e?1:a.priorityc.priority?1:0}};this.start=function(a){b=Date.now();var c=i(a);d.sort(c);for(var e=0,f=d.length;f>e;e++){var h=d[e];h.status=g.WAITING,h.resource.start(this)}setTimeout(j,100)};var j=function(){for(var b=!1,c=Date.now()-f,e=c>=a.noProgressTimeout,h=c>=a.loggingDelay,i=0,k=d.length;k>i;i++){var l=d[i];l.status===g.WAITING&&(l.resource.checkStatus&&l.resource.checkStatus(),l.status===g.WAITING&&(e?l.resource.onTimeout():b=!0))}h&&b&&m(),b&&setTimeout(j,a.statusInterval)};this.isBusy=function(){for(var a=0,b=d.length;b>a;a++)if(d[a].status===g.QUEUED||d[a].status===g.WAITING)return!0;return!1};var k=function(a,b){var c,h,i,j,k,m=null;for(c=0,h=d.length;h>c;c++)if(d[c].resource===a){m=d[c];break}if(null!=m&&m.status===g.WAITING)for(m.status=b,f=Date.now(),i=a.tags.length,c=0,h=e.length;h>c;c++)j=e[c],k=0===j.tags.length?!0:a.tags.intersects(j.tags),k&&l(m,j)};this.onLoad=function(a){k(a,g.LOADED)},this.onError=function(a){k(a,g.ERROR)},this.onTimeout=function(a){k(a,g.TIMEOUT)};var l=function(a,b){var c,e,f,h,i=0,j=0;for(c=0,e=d.length;e>c;c++)f=d[c],h=!1,h=0===b.tags.length?!0:f.resource.tags.intersects(b.tags),h&&(j++,(f.status===g.LOADED||f.status===g.ERROR||f.status===g.TIMEOUT)&&i++);b.callback({resource:a.resource,loaded:a.status===g.LOADED,error:a.status===g.ERROR,timeout:a.status===g.TIMEOUT,completedCount:i,totalCount:j})},m=this.log=function(a){if(window.console){var c=Math.round((Date.now()-b)/1e3);window.console.log("PxLoader elapsed: "+c+" sec");for(var e=0,f=d.length;f>e;e++){var h=d[e];if(a||h.status===g.WAITING){var i="PxLoader: #"+e+" "+h.resource.getName();switch(h.status){case g.QUEUED:i+=" (Not Started)";break;case g.WAITING:i+=" (Waiting)";break;case g.LOADED:i+=" (Loaded)";break;case g.ERROR:i+=" (Error)";break;case g.TIMEOUT:i+=" (Timeout)"}h.resource.tags.length>0&&(i+=" Tags: ["+h.resource.tags.all.join(",")+"]"),window.console.log(i)}}}}}function c(a){if(this.all=[],this.first=null,this.length=0,this.lookup={},a){if(Array.isArray(a))this.all=a.slice(0);else if("object"==typeof a)for(var b in a)a.hasOwnProperty(b)&&this.all.push(b);else this.all.push(a);this.length=this.all.length,this.length>0&&(this.first=this.all[0]);for(var c=0;c