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