/**
 * jQuery.Preload - Multifunctional preloader
 * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com
 * Licensed under GPL license (http://www.opensource.org/licenses/gpl-license.php).
 * Date: 2/11/2008
 * @author Ariel Flesler
 * @version 1.0.3
 **/
;(function($){var j=$.preload=function(g,h){if(g.split)g=$(g);if(!g.length)return;h=$.extend({},j.defaults,h);var a=$.map(g,function(a){if(!a)return'';if(a.split)return h.base+a+h.ext;var b=a[f]||a.href||'';if(h[d]&&a[f])a[f]=h[d];if(h.find)b=b.replace(h.find,h.replace);return b}),b={loaded:0,failed:0,next:0,done:0,total:a.length},c=$(Array(h.threshold)).map(function(){return new Image}).load(d).error(d).each(f);function d(e){b.found=e.type=='load';b.image=this[f];var a=b.original=g[this.index];b[b.found?'loaded':'failed']++;b.done++;if(h[d]&&a[f])a[f]=b.found&&b.image||h.notFound||a[f];if(h.onComplete)h.onComplete(b);if(b.done<b.total)f(0,this);else{c.unbind('load').unbind('error');c=null;if(h.onFinish)h.onFinish(b)}};function f(i,n){if(b.next==b.total)return false;n.index=b.next;n[f]=a[b.next++];if(h.onRequest){b.image=n[f];b.original=g[b.next-1];h.onRequest(b)}}},d='placeholder',f='src';j.defaults={threshold:1,base:'',ext:'',replace:''};$.fn.preload=function(a){j(this,a);return this}})(jQuery);