/*=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.4.1
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2018 vBulletin Solutions Inc. All Rights Reserved.  # ||
|| # This file may not be redistributed in whole or significant part.   # ||
|| # ----------------- VBULLETIN IS NOT FREE SOFTWARE ----------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html   # ||
|| ###################################################################### ||
\*========================================================================*/
window.vBulletin=window.vBulletin||{};window.vBulletin.phrase=window.vBulletin.phrase||{};window.vBulletin.phrase.precache=window.vBulletin.phrase.precache||[];window.vBulletin.phrase.precache=$.merge(window.vBulletin.phrase.precache,["more_options"]);window.vBulletin.CompMenuHorizontal=window.vBulletin.CompMenuHorizontal||{};window.vBulletin.jsexec=window.vBulletin.jsexec||{};window.vBulletin.jsexec.css_b_comp_menu_horizontal=window.vBulletin.jsexec.css_b_comp_menu_horizontal||{exec:0,init:0};window.vBulletin.jsexec.css_b_comp_menu_horizontal.exec++;(function(D){var E=[];function N(T,R,S){function V(W,X){if(W.is("."+X)){W.removeClass(X);var Y=W.data("removed-classes")||[];if(D.inArray(X,Y)==-1){Y.push(X)}W.data("removed-classes",Y)}}function U(W,Y){if(!W.is("."+Y)){W.addClass(Y);var X=W.data("added-classes")||[];if(D.inArray(Y,X)==-1){X.push(Y)}W.data("added-classes",X)}}T.each(function(){var W=D(this);D.each(R,function(X,Y){V(W,Y)});D.each(S,function(X,Y){U(W,Y)})})}function A(R){R.each(function(){var S=D(this),U=S.data("added-classes")||[],T=S.data("removed-classes")||[];if(U.length){S.removeClass(U.join(" "))}if(T.length){S.addClass(T.join(" "))}})}function M(R){E.push(R)}function H(R,S,T){D.each(E,function(U,V){V(R,S,T)})}function O(T,U,V){if(!T.is(".js-comp-menu-dropdown__content--main-menu")){return }if(V=="dropdown"){var S=T.find(".current").addClass("b-comp-menu-dropdown__content-item--current");U.addClass("b-comp-menu-dropdown--main-menu").find(".js-comp-menu-dropdown__trigger").addClass("b-comp-menu-dropdown__trigger--icon-trigger").html('<span class="b-icon b-icon__hamburger b-comp-menu-dropdown__trigger-icon"></span>');T.find("li").first().addClass("b-comp-menu-dropdown__content-item--divider");var R='<li class="js-search-item b-comp-menu-dropdown__content-item--no-hover js-comp-menu-dropdown__content-maintain-menu"><form action="'+D("#searchForm").attr("action")+'"><input type="text" autocomplete="off" class="b-form-input__input search-term" placeholder="'+vBulletin.phrase.get("search")+'..." name="q"><button title="'+vBulletin.phrase.get("search")+'" class="search-btn" type="submit"><span class="b-icon b-icon__search b-icon--show-on-xsmall"></span></button></form></li><li class="js-search-item"><a href="'+pageData.baseurl+'/search">'+vBulletin.phrase.get("advanced_search")+"</a></li>";D(R).prependTo(T);D(".js-channel-subtabbar-list li").addClass("js-subtabbar-item b-comp-menu-dropdown__content-item--indent1").insertAfter(S);D(".js-channel-subtabbar").addClass("h-hide")}else{T.find("li").removeClass("b-comp-menu-dropdown__content-item--divider b-comp-menu-dropdown__content-item--current b-comp-menu-dropdown__content-item--indent1");T.find(".js-search-item").remove();T.find(".js-subtabbar-item").appendTo(D(".js-channel-subtabbar-list"));D(".js-channel-subtabbar").removeClass("h-hide")}}function J(R,S,T){if(!R.is(".js-footer-nav-list")){return }if(T=="dropdown"){N(R,["h-right"],[]);N(S,[],["js-select-on-xsmall"]);var U=D("<li></li>").append(S).appendTo(".js-footer-chooser-list");R.data("vb-remove-li",U)}else{R.insertAfter(".js-footer-chooser-list");R.data("vb-remove-li").remove()}}function F(S,U,V){if(V=="dropdown"){var W=S.find(".js-comp-menu--exclude-from-dropdown");if(W.length>0){var R=D("<ul />").addClass(S.get(0).className).removeClass("js-comp-menu-horizontal js-comp-menu--dropdown-on-xsmall js-comp-menu--dropdown-on-small b-comp-menu-dropdown--inactive").insertAfter(U);S.data("vb-exclude-item-container",R);W.each(function(X,Y){var Z=D(this);D("<li />").addClass("js-excluded-item-marker h-hide-imp").data("vb-excluded-item",Z).insertAfter(Z)});W.appendTo(R)}}else{var R=S.data("vb-exclude-item-container"),T=S.find(".js-excluded-item-marker");if(R&&R.length&&R.length>0&&T.length>0){T.each(function(X,Z){var Y=D(this);Y.data("vb-excluded-item").insertAfter(Y)});T.remove();S.data("vb-exclude-item-container",false);R.remove()}}}function Q(R,Z,Y){if(!R.is(".js-module-tab-menu")){return }var W=R.closest(".widget-tabs-nav, .js-widget-tabs-nav"),U=W.find(".module-title, .js-module-title"),S=R.find("li"),T=S.filter(".ui-state-active"),a=R.find("a");W.addClass("js-widget-tabs-nav");U.addClass("js-module-title");function X(c){var b=D(this),d=b.closest("li");S.removeClass("b-comp-menu-dropdown__content-item--current ui-tabs-active ui-state-active ui-state-hover ui-state-default");d.addClass("b-comp-menu-dropdown__content-item--current")}if(Y=="dropdown"){N(R,["ui-tabs-nav","ui-helper-reset","ui-helper-clearfix","ui-widget-header","ui-corner-all"],[]);N(Z,[],["js-select-on-xsmall"]);N(W,["widget-tabs-nav"],["widget-tabs-nav-background"]);N(U,["module-title"],[]);N(S,["ui-helper-reset","ui-helper-clearfix","ui-widget-header","ui-corner-all","ui-corner-bottom","ui-corner-top","ui-corner-right","ui-corner-left","ui-corner-br","ui-corner-bl","ui-corner-tr","ui-corner-tl"],[]);N(a,["ui-tabs-anchor","h-block"],[]);if(T.length){T.addClass("b-comp-menu-dropdown__content-item--current")}else{setTimeout(function(){var e=S.filter(".ui-state-active");e.addClass("b-comp-menu-dropdown__content-item--current");var b=Z.data("vb-using-select"),c=Z.data("vb-select-el"),d=0;if(b&&c&&c.length){S.each(function(g,h){d=g;if(D(h).is(".ui-state-active")){return false}});var f=c.is(".selectBox");if(f){c.selectBox("destroy")}c.find(".js-noop-label").remove();c.get(0).selectedIndex=d;if(f){c.selectBox()}}},0)}S.removeClass("ui-state-default ui-tabs-active ui-state-active ui-state-hover");a.off("click.vbmoduletabs").on("click.vbmoduletabs",X);Z.data("add-classes-to-select-el","h-margin-vert-m h-margin-horiz-xl")}else{var V=Z.data("vb-select-el");if(V&&V.length){V.remove()}S.filter(function(){return(D(this).attr("aria-selected")=="true")}).removeClass("b-comp-menu-dropdown__content-item--current").addClass("ui-tabs-active ui-state-active");a.off("click.vbmoduletabs");A(W);A(U)}}function G(S,U,W){if(!S.is(".js-groupblog-admin-menu")){return }var T=S.closest(".js-blog-admin-left"),R=S.find("li"),V=R.filter(".sgAdminActive, .blogAdminActive");if(W=="dropdown"){N(U,[],["js-select-on-xsmall"]);V.addClass("b-comp-menu-dropdown__content-item--current")}else{}}function L(T,U,V){if(!T.is(".js-sharing-menu")){return }var S=T.find("li");if(V=="dropdown"){var R=T.prevAll(".userinfo");if(R.length==1){U.appendTo(R);T.data("vb-moved-to-userinfo","1")}N(T,["b-sharing-menu--horizontal"],[]);N(U,[],["h-align-bottom"]);N(S,[],["b-comp-menu-dropdown__content-item--no-hover","js-comp-menu-dropdown__content-maintain-menu"])}else{if(T.data("vb-moved-to-userinfo")=="1"){var R=U.parent(".userinfo");T.insertAfter(R).data("vb-moved-to-userinfo","0")}A(S)}}function K(R,U){if(U=="dropdown"){var Y=R.data("dropdown-icon-classes")||"",d=Y?" b-comp-menu-dropdown__trigger--icon-trigger":"",V=(R.data("dropdown-trigger-classes")||"")+d,c=R.data("dropdown-trigger-phrase")||"more_options",W=R.data("dropdown-menu-classes")||"",X=D('<div class="b-comp-menu-dropdown js-comp-menu-dropdown '+W+'"> <div class="b-comp-menu-dropdown__trigger js-comp-menu-dropdown__trigger js-button '+V+'" tabindex="0"> <span class="'+Y+' b-comp-menu-dropdown__trigger-icon"> '+vBulletin.phrase.get(c)+" </span>  </div> </div>");X.insertAfter(R);H(R,X,U);var S=R.find("li"),a=R.find("a");var T=["h-right","h-left"];D.each(T,function(e,f){if(R.is("."+f)){X.addClass(f)}});var b=R.data("dropdown-content-classes"),Z=["b-comp-menu-dropdown__content","js-comp-menu-dropdown__content"];if(b){b=b.split(" ")}else{b=[]}D.each(b,function(e,f){Z.push(f)});N(R,["h-margin-top-s","h-right","b-comp-menu-horizontal","channel-tabbar-list","h-hide-on-small","nav-list"],Z);N(S,["h-margin-top-xs","b-post-control","b-post-control--responsive"],["b-comp-menu-dropdown__content-item"]);N(a,["h-left"],["h-block"]);R.appendTo(X);vBulletin.CompMenuDropdown.init()}else{vBulletin.CompMenuDropdown.updateMenuAsSelectElement();var S=R.find("li"),a=R.find("a");A(R);A(S);A(a);var X=R.closest(".js-comp-menu-dropdown");vBulletin.CompMenuDropdown.setMenuColumnCount(X,R,1);R.removeClass("b-comp-menu-dropdown__content--left b-comp-menu-dropdown__content--right");R.insertAfter(X);H(R,X,U);X.remove()}}function B(S,R){I()}function C(S){var R=[S,S.parent()],U=false;D.each(R,function(V,W){if(W.is(".js-shrink-event-parent")){var X=vBulletin.Responsive.Debounce.checkElementShrinkRequirement(W);if(X=="need_shrink"){U=true;return false}}});if(S.is(".js-comp-menu-dropdown__content--main-menu")&&!U){var T=vBulletin.Responsive.Debounce.checkElementShrinkRequirement(D(".js-channel-subtabbar-list"));if(T=="need_shrink"){U=true}}return U}function I(){var S=D(".js-comp-menu-horizontal");if(S.length){var U=D("body"),T=U.is(".l-small"),R=U.is(".l-xsmall");S.each(function(V){var Z=D(this),Y=Z.find("li").not(".b-post-control--disabled").length,b=true,a=false;if(Z.data("is-dropdown-menu")){var X=Z.closest(".js-comp-menu-dropdown");if(X.is(".b-comp-menu-dropdown--open")){b=false}}if(b){if(Z.data("is-dropdown-menu")){K(Z,"horizontal");Z.data("is-dropdown-menu","")}a=C(Z)}var W=((T&&Z.is(".js-comp-menu--dropdown-on-small"))||(R&&Z.is(".js-comp-menu--dropdown-on-xsmall"))||a);if(W&&Y>0){if(!Z.data("is-dropdown-menu")){K(Z,"dropdown");Z.data("is-dropdown-menu","1")}}else{if(Z.data("is-dropdown-menu")){K(Z,"horizontal");Z.data("is-dropdown-menu","")}}})}}function P(){M(O);M(J);M(F);M(Q);M(G);M(L);I();if(window.vBulletin.jsexec.css_b_comp_menu_horizontal.init<1){vBulletin.Responsive.Debounce.registerCallback(I);D(document).on("vb-loadnewposts",B);D(document).on("vb-filterposts",B)}window.vBulletin.jsexec.css_b_comp_menu_horizontal.init++}vBulletin.CompMenuHorizontal.registerMenuChangeFilter=M;vBulletin.CompMenuHorizontal.checkHorizontalMenuState=I;D(P)})(jQuery);