/**
 * jQuery.Preload - Multifunctional preloader
 * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com
 * Dual licensed under MIT and GPL.
 * Date: 3/5/2008
 * @author Ariel Flesler
 * @version 1.0.5
 **/
;(function($){var m=$.preload=function(c,d){if(c.split)c=$(c);d=$.extend({},m.defaults,d);var f=$.map(c,function(a){if(!a)return null;if(a.split)return d.base+a+d.ext;var b=a.src||a.href||'';if(d.placeholder&&a.src)a.src=d.placeholder;if(d.find)b=b.replace(d.find,d.replace);return b}),g={loaded:0,failed:0,next:0,done:0,total:f.length},h='<img/>';while(--d.threshold>0)h+='<img/>';if(g.total)h=$(h).load(j).error(j).each(k);else l();function j(e){g.found=e.type=='load';g.image=this.src;var a=g.original=c[this.index];g[g.found?'loaded':'failed']++;g.done++;if(d.placeholder&&a.src)a.src=g.found&&g.image||d.notFound||a.src;if(d.onComplete)d.onComplete(g);if(g.done<g.total)k(0,this);else{h.unbind('load').unbind('error');h=null;l()}};function k(i,a){if(g.next==g.total)return false;a.index=g.next;a.src=f[g.next++];if(d.onRequest){g.image=a.src;g.original=c[g.next-1];d.onRequest(g)}};function l(){if(d.onFinish)d.onFinish(g)}};m.defaults={threshold:1,base:'',ext:'',replace:''};$.fn.preload=function(a){m(this,a);return this}})(jQuery);