!function(a,o,n,l){var h=a(o);a.fn.lazyload=function(e){function t(){var t=0;r.each(function(){var e=a(this);if(!f.skip_invisible||e.is(":visible"))if(a.abovethetop(this,f)||a.leftofbegin(this,f));else if(a.belowthefold(this,f)||a.rightoffold(this,f)){if(++t>f.failure_limit)return!1}else e.trigger("appear"),t=0})}var i,r=this,f={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:o,data_attribute:"original",skip_invisible:!0,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return e&&(l!==e.failurelimit&&(e.failure_limit=e.failurelimit,delete e.failurelimit),l!==e.effectspeed&&(e.effect_speed=e.effectspeed,delete e.effectspeed),a.extend(f,e)),i=f.container===l||f.container===o?h:a(f.container),0===f.event.indexOf("scroll")&&i.bind(f.event,function(){return t()}),this.each(function(){var o=this,n=a(o);o.loaded=!1,(n.attr("src")===l||n.attr("src")===!1)&&n.is("img")&&n.attr("src",f.placeholder),n.one("appear",function(){if(!this.loaded){if(f.appear){var e=r.length;f.appear.call(o,e,f)}a("").bind("load",function(){var e=n.attr("data-"+f.data_attribute);n.hide(),n.is("img")?n.attr("src",e):n.css("background-image","url('"+e+"')"),n[f.effect](f.effect_speed),o.loaded=!0;var t=a.grep(r,function(e){return!e.loaded});if(r=a(t),f.load){var i=r.length;f.load.call(o,i,f)}}).attr("src",n.attr("data-"+f.data_attribute))}}),0!==f.event.indexOf("scroll")&&n.bind(f.event,function(){o.loaded||n.trigger("appear")})}),h.bind("resize",function(){t()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&h.bind("pageshow",function(e){e.originalEvent&&e.originalEvent.persisted&&r.each(function(){a(this).trigger("appear")})}),a(n).ready(function(){t()}),this},a.belowthefold=function(e,t){var i;return i=t.container===l||t.container===o?(o.innerHeight?o.innerHeight:h.height())+h.scrollTop():a(t.container).offset().top+a(t.container).height(),i<=a(e).offset().top-t.threshold},a.rightoffold=function(e,t){var i;return i=t.container===l||t.container===o?h.width()+h.scrollLeft():a(t.container).offset().left+a(t.container).width(),i<=a(e).offset().left-t.threshold},a.abovethetop=function(e,t){var i;return i=t.container===l||t.container===o?h.scrollTop():a(t.container).offset().top,i>=a(e).offset().top+t.threshold+a(e).height()},a.leftofbegin=function(e,t){var i;return i=t.container===l||t.container===o?h.scrollLeft():a(t.container).offset().left,i>=a(e).offset().left+t.threshold+a(e).width()},a.inviewport=function(e,t){return!(a.rightoffold(e,t)||a.leftofbegin(e,t)||a.belowthefold(e,t)||a.abovethetop(e,t))},a.extend(a.expr[":"],{"below-the-fold":function(e){return a.belowthefold(e,{threshold:0})},"above-the-top":function(e){return!a.belowthefold(e,{threshold:0})},"right-of-screen":function(e){return a.rightoffold(e,{threshold:0})},"left-of-screen":function(e){return!a.rightoffold(e,{threshold:0})},"in-viewport":function(e){return a.inviewport(e,{threshold:0})},"above-the-fold":function(e){return!a.belowthefold(e,{threshold:0})},"right-of-fold":function(e){return a.rightoffold(e,{threshold:0})},"left-of-fold":function(e){return!a.rightoffold(e,{threshold:0})}})}(jQuery,window,document);