!function(o){"use strict";o.fn.jsticky=function(s){var t={item_offset:".jeg_header",wrapper:".jeg_navbar_wrapper",state_class:".jeg_sticky_nav",mode:"scroll",use_translate3d:!0,onScrollDown:!1,onScrollUp:!1,onStickyRemoved:!1,broadcast_position:!1};return s=s?o.extend(t,s):o.extend(t),o(this).each((function(){var t,n=1==jnewsoption.admin_bar?32:0,e=0,a=0,i=0,r=o(this),l=r.outerHeight(),c=0,d=0,p=0,f=function(){1==jnewsoption.admin_bar&&(o(window).width()<=782&&o(window).width()>600?n=46:o(window).width()<=600&&(n=0)),t=o(".sticky_blankspace").offset().top};f();o(window).on("scroll",(function(){if("normal"!==s.mode){if(d=o(this).scrollTop(),p=Math.abs(d-a),r.hasClass(s.state_class)||r.addClass("notransition"),d>a){if("scroll"===s.mode){if(d<t+l)return}else if(d<t-n)return;r.addClass(s.state_class),"scroll"===s.mode?(c=i-p)<-l&&(c=-l):"pinned"===s.mode&&p>5&&d>l+n&&(c=-l),"function"==typeof s.onScrollDown&&s.onScrollDown()}else d>t-n?(r.removeClass("notransition"),"scroll"===s.mode&&(c=i+p),("pinned"===s.mode&&p>5||c>0)&&(c=0,r.removeClass("notransition"))):(r.removeClass(s.state_class),c=0,"function"==typeof s.onStickyRemoved&&s.onStickyRemoved()),"function"==typeof s.onScrollUp&&s.onScrollUp();e=d<t-n?0:c+n,r.hasClass(s.state_class)?s.use_translate3d?r.css({"-webkit-transform":"translate3d(0px, "+e+"px, 0px)",transform:"translate3d(0px, "+e+"px, 0px)"}):r.css({top:e+"px"}):s.use_translate3d?r.css({"-webkit-transform":"",transform:""}):r.css({top:""}),s.broadcast_position&&o(window).trigger("jnews_additional_sticky_margin",l+e),i=c,a=d}})),o(window).on("load resize",(function(){setTimeout(f,200)})),o(document).on("ready",f)}))}}(jQuery);