/*=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.4.0 Release Candidate 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,["error",]);window.vBulletin.options=window.vBulletin.options||{};window.vBulletin.options.precache=window.vBulletin.options.precache||[];window.vBulletin.options.precache=$.merge(window.vBulletin.options.precache,[]);(function(B){var A="left";function D(Y){var X=Y;var I=Y.find(".js-vbscroller-viewport");var W=Y.find(".js-vbscroller-content");var b=(W.data("child-selector")&&("."+W.data("child-selector")))||"";var E=Y.find(".js-vbscroller-scroll-right");var V=Y.find(".js-vbscroller-scroll-left");var N="b-vbscroller__navigation-control-button--disabled";var H=[];var T=0;var a=I.innerWidth();var G=0;var P=W.prop("scrollWidth");var K=0;var F=P-a;var U=500;function O(l){if(Y.data("vbscroller-resetting-scrollbar")=="1"){return }Y.data("vbscroller-resetting-scrollbar","1");c("to_pixel",0);H=[];T=0;var g=Math.max(Y.innerWidth(),W.outerWidth());if(g>=P){X.removeClass("b-vbscroller--enabled");c("to_pixel",0)}else{X.addClass("b-vbscroller--enabled")}G=a;a=I.innerWidth();P=W.prop("scrollWidth");F=P-a;if(G>0&&F>0){c("to_pixel",K*F)}var f=(b&&W.find(b))||W.children();T=f.length;if(T){var o=0,k=0,n=0,d=0,h=0;if(A=="right"){h=B(f[T-1]).position().left}for(var j=0;j<T;j++){var m=B(f[j]);o=m.position().left-h;k=o+m.outerWidth();if(A=="left"){n=o;d=k}else{n=P-k;d=P-o}H.push({$:m,start:n,end:d})}}var q=W.find(".js-vbscroller-selected-item");if(q.length==1){var p=q.position().left-(a/2)+(q.outerWidth()/2);c("to_pixel",p)}Z();Y.data("vbscroller-resetting-scrollbar","0")}function R(){Y.find("img").on("load",function(d){O()})}function Z(){var f=M(),e,d;if(A=="left"){e=f;d=P-(f+a)}else{e=P-(f+a);d=f}if(e<=0){V.addClass(N)}else{V.removeClass(N)}if(d<=0){E.addClass(N)}else{E.removeClass(N)}}function M(){var d=-parseFloat(W.css(A));if(isNaN(d)){d=0;currentOtherEdge=a;W.css(A,0)}return d}function c(m,h,e){var o=0,f=0,l=0,d=null,k=M(),g=k+a,p=1;if(A=="right"){p=-1}switch(m){case"left":case"right":if(m==A){for(var j=T-1;j>=0;j--){d=H[j];if(g-d.end>1){break}}l=d.end-a;if(l>=k||k-l<1||k-l>a){l=k-a/2}}else{for(var j=0;j<T;j++){d=H[j];if(d.start-k>1){break}}l=d.start;if(l<=k||l-k<1||l-k>a){l=k+a/2}}break;case"left_small":l=k-p*20;break;case"right_small":l=k+p*20;break;case"by_pixels":case"pixels":if(h){l=k+p*h}else{return }break;case"to_pixel":if(typeof h!="undefined"){if(isNaN(h)){h=0}l=h}else{return }break;default:l=k;break}l=Math.min(Math.max(l,0),F);if(e){var n={};n[A]=-l;W.animate(n,{duration:200,queue:false,complete:function(){Z()}})}else{W.css(A,-l)}if(F>0){K=l/F}Z()}function J(){function f(){var g=vBulletin.isRtl();Y.on("DOMMouseScroll mousewheel",function(i){var k=i.originalEvent.wheelDelta?i.originalEvent.wheelDelta:-i.originalEvent.detail;var j;var h;if(k>0){j="up";h="left"}else{if(k<0){j="down";h="right"}else{return }}if(g){h=(h=="left"?"right":"left")}c(h+"_small");i.preventDefault()})}function e(){var h=false,g=false,i=0;W.on("mousedown touchstart",function(j){g=false;h=true;i=j.pageX||j.originalEvent.touches[0].pageX||0;j.preventDefault()});W.on("mousemove touchmove",function(l){if(h){var j=l.pageX||l.originalEvent.touches[0].pageX||0;var k=i-j;if(k!=0){g=true;c("pixels",k)}i=j}});W.on("mouseup mouseleave touchcancel",function(j){h=false;j.preventDefault()});W.on("click touchend",function(j){if(g){return false}g=false})}function d(i){var k;switch(i.selector){case".js-vbscroller-scroll-right":k="right";break;case".js-vbscroller-scroll-left":k="left";break;default:return ;break}var l,g,j,h;i.on("mousedown",function(m){g=true;l=Date.now();j=setTimeout(function(){c(k+"_small");h=setInterval(function(){c(k+"_small")},100)},U)});i.on("mouseup mouseleave",function(m){clearTimeout(j);clearInterval(h);if(g){if(Date.now()-l<=U){c(k,0,true)}}g=false})}f();e();d(E);d(V)}function Q(){vBulletin.Responsive.Debounce.registerCallback(O);Y.on("event-js-element-resize-start",O);Y.on("event-js-content-change",R);Y.on("event-js-vbscroller-reset",O)}function L(){Q();J();R();O()}function S(){var d=Y.data("vbscroller-initialized")=="1";if(d){window.setTimeout(function(){Y.trigger("event-js-vbscroller-reset")},0)}else{L();Y.data("vbscroller-initialized","1")}}S()}function C(){B(function(){if(pageData.textdirection&&pageData.textdirection=="rtl"){A="right"}B(".js-vbscroller-wrapper").each(function(){var E=B(this);if(!E.data("manual-init")){D(E)}})})}window.vBulletin.vBScroller=window.vBulletin.vBScroller||{};vBulletin.vBScroller.initializeScroller=D;C()})(jQuery);