/**
 * Copyright (c) 2013 - 2019 fusionCSS. All rights reserved.
 * @link http://fusionCSS.com
 * @version 3.3.0
 */
!function(){var a=[],f=$(window).scrollTop(),t=[];function l(t,e){f>=a[t].top&&a[t].before?(a[t].before=!1,a[t].handler.call(a[t].element,e,a[t]),a[t].element.trigger("pointReached",[e])):f<a[t].top&&!a[t].before&&(a[t].before=!0,a[t].handler.call(a[t].element,e,a[t]),a[t].element.trigger("pointReached",[e]))}function s(t){var e=t.offset;if(t.stoppedBy)for(var s=t.stoppedBy;e+=s.outerHeight(!0),s=s[0]._stickyOpts?s[0]._stickyOpts.stoppedBy:null;);return e}$.fn.extend({trackPoint:function(t){var s=(t=t||{}).offset||0,o=t.handler||function(){},i=t.onBeforeResize||function(){},n=t.onAfterResize||function(){},r="string"==typeof s&&s.match(/%$/)?"%":"px";return this.each(function(){var t=$(this),e="%"==r?parseInt(s)/100*$(window).height():parseInt(s),e={element:t,top:t.offset().top-e,before:!0,offset:s,offsetPixels:e,handler:o,onBeforeResize:i,onAfterResize:n};a.push(e),t.wrap('<div class="trackPointWrapper"></div>'),e.top<=f&&l(a.length-1,"down"),a.sort(function(t,e){return e.top-t.top})})},trackPointSetOffset:function(o){var i="string"==typeof o&&o.match(/%$/)?"%":"px";return this.each(function(){for(var t=0;t<a.length;t++)if(this===a[t].element[0]){var e=a[t].top,s="%"==i?parseInt(o)/100*$(window).height():parseInt(o);a[t].top=a[t].element.offset().top-s,a[t].offset=o,a[t].offsetPixels=s,e!=a[t].top&&l(t,a[t].top>e?"up":"down");break}})}}),$(window).on("scroll",function(){var t=$(window).scrollTop(),e=f<t?"down":"up";if(t!=f){f=t;for(var s=0;s<a.length;s++)l(s,e)}}).on("resize",function(){for(var t=0;t<a.length;t++){a[t].onBeforeResize.call(a[t].element,a[t]);var e=a[t].top,s="%"==("string"==typeof a[t].offset&&a[t].offset.match(/%$/)?"%":"px")?parseInt(a[t].offset)/100*$(window).height():parseInt(a[t].offset);a[t].top=a[t].element.offset().top-s,a[t].offsetPixels=s,e!=a[t].top&&l(t,a[t].top>e?"up":"down"),a[t].onAfterResize.call(a[t].element,a[t])}}),$.fn.extend({stickyOnScroll:function(e){return(e=e||{}).stuckClass=e.stuckClass||"stuck",e.handler=e.handler||function(){},e.offset=e.offset||0,e.stuck=!1,e.stoppedBy=e.stoppedBy||null,e.releasedBy=e.releasedBy||null,e.releasedByEdge=e.releasedByEdge||"bottom",e.released=!1,e.setTop=void 0===e.setTop||e.setTop,this.each(function(){var o=$(this);o[0]._stickyOpts=e,o.trackPoint({handler:function(t,e){var s=this[0]._stickyOpts;"down"==t?(s.stuck=!0,this.parent().height(this.outerHeight(!0)),this.addClass(s.stuckClass),s.setTop&&this.css("top",e.offsetPixels+"px"),s.handler.call(this,"stuck"),this.trigger("stuck"),s.releasedBy&&s.releasedBy.trackPointSetOffset(-("top"===s.releasedByEdge?0:s.releasedBy.outerHeight(!1))+(this.position().top+this.outerHeight(!1)))):"up"==t&&(s.stuck=!1,this.parent().height(""),this.removeClass(s.stuckClass),s.handler.call(this,"unstuck"),this.trigger("unstuck"))},onBeforeResize:function(){this[0]._stickyOpts.stuck&&(this.parent().height(""),this.removeClass(e.stuckClass)),this.trackPointSetOffset(s(this[0]._stickyOpts))},onAfterResize:function(t){this[0]._stickyOpts.stuck&&(this.parent().height(this.outerHeight(!0)),this.addClass(e.stuckClass).css("top",t.offsetPixels+"px"),e.releasedBy)&&e.releasedBy.trackPointSetOffset(-("top"===e.releasedByEdge?0:e.releasedBy.outerHeight(!1))+(this.position().top+this.outerHeight(!1)))},offset:s(e)}),e.releasedBy&&e.releasedBy.trackPoint({handler:function(t,e){var s=o[0]._stickyOpts;s.stuck&&("up"==t?(o.addClass(s.stuckClass),s.released=!1):"down"==t&&(o.removeClass(s.stuckClass),s.released=!0))},onBeforeResize:function(){o[0]._stickyOpts.released&&o[0]._stickyOpts.stuck&&o.add(e.stuckClass)},onAfterResize:function(t){o[0]._stickyOpts.released&&o[0]._stickyOpts.stuck&&o.removeClass(e.stuckClass)},offset:-("top"===e.releasedByEdge?0:e.releasedBy.outerHeight(!1))+(o.position().top+o.outerHeight(!1))}),o.parent().addClass("stickyWrapper"),t.push(o)})},stickyOnScrollOffset:function(t){return this.each(function(){this._stickyOpts.offset=t,$(this).trackPointSetOffset(s(this._stickyOpts))})}})}();