(function(n){n.fn.lazyload=function(t){var i={threshold:0,failurelimit:0,event:"scroll",effect:"show",container:window},r;return t&&n.extend(i,t),r=this,"scroll"==i.event&&n(i.container).bind("scroll",function(){var u=0,t;r.each(function(){if(n.belowthefold(this,i)||n.rightoffold(this,i)){if(u++>i.failurelimit)return!1}else n(this).trigger("appear")}),t=n.grep(r,function(n){return!n.loaded}),r=n(t)}),this.each(function(){var t=this;"scroll"!=i.event||n.belowthefold(t,i)||n.rightoffold(t,i)?(i.placeholder?n(t).attr("src",i.placeholder):n(t).removeAttr("src"),t.loaded=!1):(n(t).attr("src",n(t).attr("original")),t.loaded=!0);n(t).one("appear",function(){this.loaded||n("<img />").bind("load",function(){n(t).hide().attr("src",n(t).attr("original"))[i.effect](i.effectspeed),t.loaded=!0}).attr("src",n(t).attr("original"))});"scroll"!=i.event&&n(t).bind(i.event,function(){t.loaded||n(t).trigger("appear")})})},n.belowthefold=function(t,i){var r;return r=i.container===undefined||i.container===window?n(window).height()+n(window).scrollTop():n(i.container).offset().top+n(i.container).height(),r<=n(t).offset().top-i.threshold},n.rightoffold=function(t,i){var r;return r=i.container===undefined||i.container===window?n(window).width()+n(window).scrollLeft():n(i.container).offset().left+n(i.container).width(),r<=n(t).offset().left-i.threshold},n.extend(n.expr[":"],{"below-the-fold":"$.belowthefold(a, {threshold : 0, container: window})","above-the-fold":"!$.belowthefold(a, {threshold : 0, container: window})","right-of-fold":"$.rightoffold(a, {threshold : 0, container: window})","left-of-fold":"!$.rightoffold(a, {threshold : 0, container: window})"})})(jQuery)