/* jSticky */
(function(a){a.fn.jetStickySection=function(b){var c={topSpacing:0,zIndex:"",stopper:a(".sticky-stopper"),stickyClass:!1},d=a.extend({},c,b),e=function(){return!("number"!=typeof d.zIndex)}(),f=function(){return!!(0<d.stopper.length||"number"==typeof d.stopper)}();return this.each(function(){function b(){if(!o){var a=c.outerHeight(),b=n.scrollTop(),h=m,i=c.parent().width();if(l.width(i),f&&"number"!=typeof d.stopper){var q=m.offset().top;h=q-a-g}if(k<b){if(d.stickyClass&&c.addClass(d.stickyClass),c.after(l).css({position:"fixed",top:g,width:i}),e&&c.css({zIndex:j}),f&&h<b){var r=h-b+g;c.css({top:r})}p||c.trigger("jetStickySection:stick"),p=!0}else d.stickyClass&&c.removeClass(d.stickyClass),c.css({position:"",top:"",left:"",width:""}),l.remove(),p&&c.trigger("jetStickySection:unstick"),p=!1}}var c=a(this),g=d.topSpacing,h=c.outerHeight(),i=c.outerWidth(),j=d.zIndex,k=c.offset().top-g,l=a("<div></div>").width(i).height(h).addClass("sticky-placeholder"),m=d.stopper,n=a(window),o=!1,p=!1;n.innerHeight()>h&&(c.on("jetStickySection:activated",b),n.on("scroll",b),n.on("touchmove",b),n.on("resize",b),c.on("jetStickySection:detach",function(){o=!0,n.off("scroll",b),n.off("touchmove",b),n.off("resize",b),d.stickyClass&&c.removeClass(d.stickyClass),c.css({position:"",top:"",left:"",width:""}),l.remove()}))})}})(jQuery);
