$(function(){$.fn.preloadify=function(e){function l(t){if(a[t]==false){o++;e.oneachload(u[t]);a[t]=true}if(e.imagedelay==0&&e.delay==0)$(u[t]).css("visibility","visible").animate({opacity:1},700);else if(e.delay==0){f(u[t],s);s+=e.imagedelay}else if(e.imagedelay==0){f(u[t],e.delay)}else{f(u[t],e.delay+s);s+=e.imagedelay}}function c(){for(i=0;i<u.length;i++){if(u[i].complete==true){l(i)}}}function h(){if(u[i].complete==true){l(i);i++}}function p(){r=setInterval(function(){if(o>=a.length){clearInterval(r);e.ondone();return}if(e.mode=="parallel")c();else h()},e.check_timer)}var t={delay:0,imagedelay:0,mode:"parallel",preload_parent:"a",check_timer:200,ondone:function(){},oneachload:function(e){},fadein:700,force_icon:false};var e=$.extend(t,e),n=$(this),r,i=0,s=e.imagedelay,o=0,u=n.find("img").css({display:"block",visibility:"hidden",opacity:0}),a=[],f=function(t,n){$(t).css("visibility","visible").delay(n).animate({opacity:1},e.fadein,function(){$(this).parent().removeClass("preloader").addClass("preload-done")})};u.each(function(){if($(this).parent(e.preload_parent).length==0)$(this).wrap("<span class='preloader' />");else $(this).parent().addClass("preloader");a[i++]=false});u=$.makeArray(u);o=0;i=0;s=e.imagedelay;if(e.force_icon==true){var d=$(".preloader").css("background-image");var v=/url\(|\)|"|'/g;d=d.replace(v,"");var m=jQuery("<img />",{id:"loadingicon",src:d}).hide().appendTo("body");r=setInterval(function(){if(m[0].complete==true){clearInterval(r);setTimeout(function(){p()},e.check_timer);m.remove();return}},50)}else p()}})