/* == malihu jquery custom scrollbar plugin == version: 3.0.6, license: mit license (mit) */ !function(e,t,a){!function(t){var o="function"==typeof define&&define.amd,n="https:"==a.location.protocol?"https:":"http:",i="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js";o||e.event.special.mousewheel||e("head").append(decodeuri("%3cscript src="+n+"//"+i+"%3e%3c/script%3e")),t()}(function(){var o="mcustomscrollbar",n="mcs",i=".mcustomscrollbar",r={settop:0,setleft:0,axis:"y",scrollbarposition:"inside",scrollinertia:950,autodraggerlength:!0,alwaysshowscrollbar:0,snapoffset:0,mousewheel:{enable:!0,scrollamount:"auto",axis:"y",deltafactor:"auto",disableover:["select","option","keygen","datalist","textarea"]},scrollbuttons:{scrolltype:"stepless",scrollamount:"auto"},keyboard:{enable:!0,scrolltype:"stepless",scrollamount:"auto"},contenttouchscroll:25,advanced:{autoscrollonfocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateoncontentresize:!0,updateonimageload:!0},theme:"light",callbacks:{ontotalscrolloffset:0,ontotalscrollbackoffset:0,alwaystriggeroffsets:!0}},l=0,s={},c=t.attachevent&&!t.addeventlistener?1:0,d=!1,u=["mcsb_dragger_ondrag","mcsb_scrolltools_ondrag","mcs_img_loaded","mcs_disabled","mcs_destroyed","mcs_no_scrollbar","mcs-autohide","mcs-dir-rtl","mcs_no_scrollbar_y","mcs_no_scrollbar_x","mcs_y_hidden","mcs_x_hidden","mcsb_draggercontainer","mcsb_buttonup","mcsb_buttondown","mcsb_buttonleft","mcsb_buttonright"],f={init:function(t){var t=e.extend(!0,{},r,t),a=h.call(this);if(t.live){var o=t.liveselector||this.selector||i,c=e(o);if("off"===t.live)return void p(o);s[o]=settimeout(function(){c.mcustomscrollbar(t),"once"===t.live&&c.length&&p(o)},500)}else p(o);return t.setwidth=t.set_width?t.set_width:t.setwidth,t.setheight=t.set_height?t.set_height:t.setheight,t.axis=t.horizontalscroll?"x":g(t.axis),t.scrollinertia=t.scrollinertia>0&&t.scrollinertia<17?17:t.scrollinertia,"object"!=typeof t.mousewheel&&1==t.mousewheel&&(t.mousewheel={enable:!0,scrollamount:"auto",axis:"y",preventdefault:!1,deltafactor:"auto",normalizedelta:!1,invert:!1}),t.mousewheel.scrollamount=t.mousewheelpixels?t.mousewheelpixels:t.mousewheel.scrollamount,t.mousewheel.normalizedelta=t.advanced.normalizemousewheeldelta?t.advanced.normalizemousewheeldelta:t.mousewheel.normalizedelta,t.scrollbuttons.scrolltype=v(t.scrollbuttons.scrolltype),m(t),e(a).each(function(){var a=e(this);if(!a.data(n)){a.data(n,{idx:++l,opt:t,scrollratio:{y:null,x:null},overflowed:null,contentreset:{y:null,x:null},bindevents:!1,tweenrunning:!1,sequential:{},langdir:a.css("direction"),cboffsets:null,trigger:null});var o=a.data(n),i=o.opt,r=a.data("mcs-axis"),s=a.data("mcs-scrollbar-position"),c=a.data("mcs-theme");r&&(i.axis=r),s&&(i.scrollbarposition=s),c&&(i.theme=c,m(i)),x.call(this),e("#mcsb_"+o.idx+"_container img:not(."+u[2]+")").addclass(u[2]),f.update.call(null,a)}})},update:function(t,a){var o=t||h.call(this);return e(o).each(function(){var t=e(this);if(t.data(n)){var o=t.data(n),i=o.opt,r=e("#mcsb_"+o.idx+"_container"),l=[e("#mcsb_"+o.idx+"_dragger_vertical"),e("#mcsb_"+o.idx+"_dragger_horizontal")];if(!r.length)return;o.tweenrunning&&v(t),t.hasclass(u[3])&&t.removeclass(u[3]),t.hasclass(u[4])&&t.removeclass(u[4]),b.call(this),s.call(this),"y"===i.axis||i.advanced.autoexpandhorizontalscroll||r.css("width",_(r.children())),o.overflowed=t.call(this),i.call(this),i.autodraggerlength&&c.call(this),y.call(this),m.call(this);var s=[math.abs(r[0].offsettop),math.abs(r[0].offsetleft)];"x"!==i.axis&&(o.overflowed[0]?l[0].height()>l[0].parent().height()?k.call(this):(q(t,s[0].tostring(),{dir:"y",dur:0,overwrite:"none"}),o.contentreset.y=null):(k.call(this),"y"===i.axis?o.call(this):"yx"===i.axis&&o.overflowed[1]&&q(t,s[1].tostring(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==i.axis&&(o.overflowed[1]?l[1].width()>l[1].parent().width()?k.call(this):(q(t,s[1].tostring(),{dir:"x",dur:0,overwrite:"none"}),o.contentreset.x=null):(k.call(this),"x"===i.axis?o.call(this):"yx"===i.axis&&o.overflowed[0]&&q(t,s[0].tostring(),{dir:"y",dur:0,overwrite:"none"}))),a&&o&&(2===a&&i.callbacks.onimageload&&"function"==typeof i.callbacks.onimageload?i.callbacks.onimageload.call(this):3===a&&i.callbacks.onselectorchange&&"function"==typeof i.callbacks.onselectorchange?i.callbacks.onselectorchange.call(this):i.callbacks.onupdate&&"function"==typeof i.callbacks.onupdate&&i.callbacks.onupdate.call(this)),x.call(this)}})},scrollto:function(t,a){if("undefined"!=typeof t&&null!=t){var o=h.call(this);return e(o).each(function(){var o=e(this);if(o.data(n)){var i=o.data(n),r=i.opt,l={trigger:"external",scrollinertia:r.scrollinertia,scrolleasing:"mcseaseinout",movedragger:!1,timeout:60,callbacks:!0,onstart:!0,onupdate:!0,oncomplete:!0},s=e.extend(!0,{},l,a),c=j.call(this,t),d=s.scrollinertia>0&&s.scrollinertia<17?17:s.scrollinertia;c[0]=y.call(this,c[0],"y"),c[1]=y.call(this,c[1],"x"),s.movedragger&&(c[0]*=i.scrollratio.y,c[1]*=i.scrollratio.x),s.dur=d,settimeout(function(){null!==c[0]&&"undefined"!=typeof c[0]&&"x"!==r.axis&&i.overflowed[0]&&(s.dir="y",s.overwrite="all",q(o,c[0].tostring(),s)),null!==c[1]&&"undefined"!=typeof c[1]&&"y"!==r.axis&&i.overflowed[1]&&(s.dir="x",s.overwrite="none",q(o,c[1].tostring(),s))},s.timeout)}})}},stop:function(){var t=h.call(this);return e(t).each(function(){var t=e(this);t.data(n)&&v(t)})},disable:function(t){var a=h.call(this);return e(a).each(function(){var a=e(this);if(a.data(n)){{a.data(n)}x.call(this,"remove"),o.call(this),t&&k.call(this),i.call(this,!0),a.addclass(u[3])}})},destroy:function(){var t=h.call(this);return e(t).each(function(){var a=e(this);if(a.data(n)){var i=a.data(n),r=i.opt,l=e("#mcsb_"+i.idx),s=e("#mcsb_"+i.idx+"_container"),c=e(".mcsb_"+i.idx+"_scrollbar");r.live&&p(r.liveselector||e(t).selector),x.call(this,"remove"),o.call(this),k.call(this),a.removedata(n),z(this,"mcs"),c.remove(),s.find("img."+u[2]).removeclass(u[2]),l.replacewith(s.contents()),a.removeclass(o+" _"+n+"_"+i.idx+" "+u[6]+" "+u[7]+" "+u[5]+" "+u[3]).addclass(u[4])}})}},h=function(){return"object"!=typeof e(this)||e(this).length<1?i:this},m=function(t){var a=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],o=["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"],n=["minimal","minimal-dark"],i=["minimal","minimal-dark"],r=["minimal","minimal-dark"];t.autodraggerlength=e.inarray(t.theme,a)>-1?!1:t.autodraggerlength,t.autoexpandscrollbar=e.inarray(t.theme,o)>-1?!1:t.autoexpandscrollbar,t.scrollbuttons.enable=e.inarray(t.theme,n)>-1?!1:t.scrollbuttons.enable,t.autohidescrollbar=e.inarray(t.theme,i)>-1?!0:t.autohidescrollbar,t.scrollbarposition=e.inarray(t.theme,r)>-1?"outside":t.scrollbarposition},p=function(e){s[e]&&(cleartimeout(s[e]),z(s,e))},g=function(e){return"yx"===e||"xy"===e||"auto"===e?"yx":"x"===e||"horizontal"===e?"x":"y"},v=function(e){return"stepped"===e||"pixels"===e||"step"===e||"click"===e?"stepped":"stepless"},x=function(){var t=e(this),a=t.data(n),i=a.opt,r=i.autoexpandscrollbar?" "+u[1]+"_expand":"",l=["
","
"],s="yx"===i.axis?"mcsb_vertical_horizontal":"x"===i.axis?"mcsb_horizontal":"mcsb_vertical",c="yx"===i.axis?l[0]+l[1]:"x"===i.axis?l[1]:l[0],d="yx"===i.axis?"
":"",f=i.autohidescrollbar?" "+u[6]:"",h="x"!==i.axis&&"rtl"===a.langdir?" "+u[7]:"";i.setwidth&&t.css("width",i.setwidth),i.setheight&&t.css("height",i.setheight),i.setleft="y"!==i.axis&&"rtl"===a.langdir?"989999px":i.setleft,t.addclass(o+" _"+n+"_"+a.idx+f+h).wrapinner("
");var m=e("#mcsb_"+a.idx),p=e("#mcsb_"+a.idx+"_container");"y"===i.axis||i.advanced.autoexpandhorizontalscroll||p.css("width",_(p.children())),"outside"===i.scrollbarposition?("static"===t.css("position")&&t.css("position","relative"),t.css("overflow","visible"),m.addclass("mcsb_outside").after(c)):(m.addclass("mcsb_inside").append(c),p.wrap(d)),w.call(this);var g=[e("#mcsb_"+a.idx+"_dragger_vertical"),e("#mcsb_"+a.idx+"_dragger_horizontal")];g[0].css("min-height",g[0].height()),g[1].css("min-width",g[1].width())},_=function(t){return math.max.apply(math,t.map(function(){return e(this).outerwidth(!0)}).get())},s=function(){var t=e(this),a=t.data(n),o=a.opt,i=e("#mcsb_"+a.idx+"_container");o.advanced.autoexpandhorizontalscroll&&"y"!==o.axis&&i.css({position:"absolute",width:"auto"}).wrap("
").css({width:math.ceil(i[0].getboundingclientrect().right+.4)-math.floor(i[0].getboundingclientrect().left),position:"relative"}).unwrap()},w=function(){var t=e(this),a=t.data(n),o=a.opt,i=e(".mcsb_"+a.idx+"_scrollbar:first"),r=tt(o.scrollbuttons.tabindex)?"tabindex='"+o.scrollbuttons.tabindex+"'":"",l=["","","",""],s=["x"===o.axis?l[2]:l[0],"x"===o.axis?l[3]:l[1],l[2],l[3]];o.scrollbuttons.enable&&i.prepend(s[0]).append(s[1]).next(".mcsb_scrolltools").prepend(s[2]).append(s[3])},b=function(){var t=e(this),a=t.data(n),o=e("#mcsb_"+a.idx),i=t.css("max-height")||"none",r=-1!==i.indexof("%"),l=t.css("box-sizing");if("none"!==i){var s=r?t.parent().height()*parseint(i)/100:parseint(i);"border-box"===l&&(s-=t.innerheight()-t.height()+(t.outerheight()-t.innerheight())),o.css("max-height",math.round(s))}},c=function(){var t=e(this),a=t.data(n),o=e("#mcsb_"+a.idx),i=e("#mcsb_"+a.idx+"_container"),r=[e("#mcsb_"+a.idx+"_dragger_vertical"),e("#mcsb_"+a.idx+"_dragger_horizontal")],l=[o.height()/i.outerheight(!1),o.width()/i.outerwidth(!1)],s=[parseint(r[0].css("min-height")),math.round(l[0]*r[0].parent().height()),parseint(r[1].css("min-width")),math.round(l[1]*r[1].parent().width())],d=c&&s[1]o.height(),l>o.width()]},k=function(){var t=e(this),a=t.data(n),o=a.opt,i=e("#mcsb_"+a.idx),r=e("#mcsb_"+a.idx+"_container"),l=[e("#mcsb_"+a.idx+"_dragger_vertical"),e("#mcsb_"+a.idx+"_dragger_horizontal")];if(v(t),("x"!==o.axis&&!a.overflowed[0]||"y"===o.axis&&a.overflowed[0])&&(l[0].add(r).css("top",0),q(t,"_resety")),"y"!==o.axis&&!a.overflowed[1]||"x"===o.axis&&a.overflowed[1]){var s=dx=0;"rtl"===a.langdir&&(s=i.width()-r.outerwidth(!1),dx=math.abs(s/a.scrollratio.x)),r.css("left",s),l[1].css("left",dx),q(t,"_resetx")}},m=function(){function t(){r=settimeout(function(){e.event.special.mousewheel?(cleartimeout(r),w.call(a[0])):t()},100)}var a=e(this),o=a.data(n),i=o.opt;if(!o.bindevents){if(e.call(this),i.contenttouchscroll&&d.call(this),l.call(this),i.mousewheel.enable){var r;t()}p.call(this),h.call(this),i.advanced.autoscrollonfocus&&z.call(this),i.scrollbuttons.enable&&u.call(this),i.keyboard.enable&&f.call(this),o.bindevents=!0}},o=function(){var t=e(this),o=t.data(n),i=o.opt,r=n+"_"+o.idx,l=".mcsb_"+o.idx+"_scrollbar",s=e("#mcsb_"+o.idx+",#mcsb_"+o.idx+"_container,#mcsb_"+o.idx+"_container_wrapper,"+l+" ."+u[12]+",#mcsb_"+o.idx+"_dragger_vertical,#mcsb_"+o.idx+"_dragger_horizontal,"+l+">a"),c=e("#mcsb_"+o.idx+"_container");i.advanced.releasedraggableselectors&&s.add(e(i.advanced.releasedraggableselectors)),o.bindevents&&(e(a).unbind("."+r),s.each(function(){e(this).unbind("."+r)}),cleartimeout(t[0]._focustimeout),z(t[0],"_focustimeout"),cleartimeout(o.sequential.step),z(o.sequential,"step"),cleartimeout(c[0].oncompletetimeout),z(c[0],"oncompletetimeout"),o.bindevents=!1)},i=function(t){var a=e(this),o=a.data(n),i=o.opt,r=e("#mcsb_"+o.idx+"_container_wrapper"),l=r.length?r:e("#mcsb_"+o.idx+"_container"),s=[e("#mcsb_"+o.idx+"_scrollbar_vertical"),e("#mcsb_"+o.idx+"_scrollbar_horizontal")],c=[s[0].find(".mcsb_dragger"),s[1].find(".mcsb_dragger")];"x"!==i.axis&&(o.overflowed[0]&&!t?(s[0].add(c[0]).add(s[0].children("a")).css("display","block"),l.removeclass(u[8]+" "+u[10])):(i.alwaysshowscrollbar?(2!==i.alwaysshowscrollbar&&c[0].add(s[0].children("a")).css("display","none"),l.removeclass(u[10])):(s[0].css("display","none"),l.addclass(u[10])),l.addclass(u[8]))),"y"!==i.axis&&(o.overflowed[1]&&!t?(s[1].add(c[1]).add(s[1].children("a")).css("display","block"),l.removeclass(u[9]+" "+u[11])):(i.alwaysshowscrollbar?(2!==i.alwaysshowscrollbar&&c[1].add(s[1].children("a")).css("display","none"),l.removeclass(u[11])):(s[1].css("display","none"),l.addclass(u[11])),l.addclass(u[9]))),o.overflowed[0]||o.overflowed[1]?a.removeclass(u[5]):a.addclass(u[5])},r=function(e){var t=e.type;switch(t){case"pointerdown":case"mspointerdown":case"pointermove":case"mspointermove":case"pointerup":case"mspointerup":return[e.originalevent.pagey,e.originalevent.pagex,!1];case"touchstart":case"touchmove":case"touchend":var a=e.originalevent.touches[0]||e.originalevent.changedtouches[0],o=e.originalevent.touches.length||e.originalevent.changedtouches.length;return[a.pagey,a.pagex,o>1];default:return[e.pagey,e.pagex,!1]}},e=function(){function t(e){var t=p.find("iframe");if(t.length){var a=e?"auto":"none";t.css("pointer-events",a)}}function o(e,t,a,o){if(p[0].idletimer=f.scrollinertia<233?250:0,i.attr("id")===m[1])var n="x",r=(i[0].offsetleft-t+o)*u.scrollratio.x;else var n="y",r=(i[0].offsettop-e+a)*u.scrollratio.y;q(s,r.tostring(),{dir:n,drag:!0})}var i,r,l,s=e(this),u=s.data(n),f=u.opt,h=n+"_"+u.idx,m=["mcsb_"+u.idx+"_dragger_vertical","mcsb_"+u.idx+"_dragger_horizontal"],p=e("#mcsb_"+u.idx+"_container"),g=e("#"+m[0]+",#"+m[1]),v=f.advanced.releasedraggableselectors?g.add(e(f.advanced.releasedraggableselectors)):g;g.bind("mousedown."+h+" touchstart."+h+" pointerdown."+h+" mspointerdown."+h,function(o){if(o.stopimmediatepropagation(),o.preventdefault(),$(o)){d=!0,c&&(a.onselectstart=function(){return!1}),t(!1),v(s),i=e(this);var n=i.offset(),u=r(o)[0]-n.top,h=r(o)[1]-n.left,m=i.height()+n.top,p=i.width()+n.left;m>u&&u>0&&p>h&&h>0&&(r=u,l=h),b(i,"active",f.autoexpandscrollbar)}}).bind("touchmove."+h,function(e){e.stopimmediatepropagation(),e.preventdefault();var t=i.offset(),a=r(e)[0]-t.top,n=r(e)[1]-t.left;o(r,l,a,n)}),e(a).bind("mousemove."+h+" pointermove."+h+" mspointermove."+h,function(e){if(i){var t=i.offset(),a=r(e)[0]-t.top,n=r(e)[1]-t.left;if(r===a)return;o(r,l,a,n)}}).add(v).bind("mouseup."+h+" touchend."+h+" pointerup."+h+" mspointerup."+h,function(){i&&(b(i,"active",f.autoexpandscrollbar),i=null),d=!1,c&&(a.onselectstart=null),t(!0)})},d=function(){function t(e,t){var a=[1.5*t,2*t,t/1.5,t/2];return e>90?t>4?a[0]:a[3]:e>60?t>3?a[3]:a[2]:e>30?t>8?a[1]:t>6?a[0]:t>4?t:a[2]:t>8?t:a[3]}function a(e,t,a,o,n,i){e&&q(g,e.tostring(),{dur:t,scrolleasing:a,dir:o,overwrite:n,drag:i})}var o,i,r,l,s,c,u,f,h,m,p,g=e(this),v=g.data(n),x=v.opt,_=n+"_"+v.idx,s=e("#mcsb_"+v.idx),w=e("#mcsb_"+v.idx+"_container"),b=[e("#mcsb_"+v.idx+"_dragger_vertical"),e("#mcsb_"+v.idx+"_dragger_horizontal")],c=[],y=[],b=0,t="yx"===x.axis?"none":"all",k=[];w.bind("touchstart."+_+" pointerdown."+_+" mspointerdown."+_,function(e){if(et(e)&&!d&&!r(e)[2]){var t=w.offset();o=r(e)[0]-t.top,i=r(e)[1]-t.left,k=[r(e)[0],r(e)[1]]}}).bind("touchmove."+_+" pointermove."+_+" mspointermove."+_,function(e){if(et(e)&&!d&&!r(e)[2]){e.stopimmediatepropagation(),c=j();var t=s.offset(),n=r(e)[0]-t.top,r=r(e)[1]-t.left,l="mcslinearout";if(c.push(n),y.push(r),k[2]=math.abs(r(e)[0]-k[0]),k[3]=math.abs(r(e)[1]-k[1]),v.overflowed[0])var s=b[0].parent().height()-b[0].height(),u=o-n>0&&n-o>-(s*v.scrollratio.y)&&(2*k[3]0&&r-i>-(f*v.scrollratio.x)&&(2*k[2]30)){h=1e3/(u-s);var g="mcseaseout",_=2.5>h,b=_?[c[c.length-2],y[y.length-2]]:[0,0];f=_?[n-b[0],i-b[1]]:[n-r,i-l];var b=[math.abs(f[0]),math.abs(f[1])];h=_?[math.abs(f[0]/4),math.abs(f[1]/4)]:[h,h];var k=[math.abs(w[0].offsettop)-f[0]*t(b[0]/h[0],h[0]),math.abs(w[0].offsetleft)-f[1]*t(b[1]/h[1],h[1])];m="yx"===x.axis?[k[0],k[1]]:"x"===x.axis?[null,k[1]]:[k[0],null],p=[4*b[0]+x.scrollinertia,4*b[1]+x.scrollinertia];var m=parseint(x.contenttouchscroll)||0;m[0]=b[0]>m?m[0]:0,m[1]=b[1]>m?m[1]:0,v.overflowed[0]&&a(m[0],p[0],g,"y",t,!1),v.overflowed[1]&&a(m[1],p[1],g,"x",t,!1)}}})},l=function(){function o(){return t.getselection?t.getselection().tostring():a.selection&&"control"!=a.selection.type?a.selection.createrange().text:0}function i(e,t,a){u.type=a&&r?"stepped":"stepless",u.scrollamount=10,q(l,e,t,"mcslinearout",a?60:null)}var r,l=e(this),s=l.data(n),c=s.opt,u=s.sequential,f=n+"_"+s.idx,h=e("#mcsb_"+s.idx+"_container"),m=h.parent();h.bind("mousedown."+f,function(){r||(r=1,d=!0)}).add(a).bind("mousemove."+f,function(e){if(r&&o()){var t=h.offset(),a=r(e)[0]-t.top+h[0].offsettop,n=r(e)[1]-t.left+h[0].offsetleft;a>0&&a0&&na?i("on",38):a>m.height()&&i("on",40)),"y"!==c.axis&&s.overflowed[1]&&(0>n?i("on",37):n>m.width()&&i("on",39)))}}).bind("mouseup."+f,function(){r&&(r=0,i("off",null)),d=!1})},w=function(){function t(e){var t=null;try{var a=e.contentdocument||e.contentwindow.document;t=a.body.innerhtml}catch(o){}return null!==t}var a=e(this),o=a.data(n);if(o){var i=o.opt,r=n+"_"+o.idx,l=e("#mcsb_"+o.idx),s=[e("#mcsb_"+o.idx+"_dragger_vertical"),e("#mcsb_"+o.idx+"_dragger_horizontal")],d=e("#mcsb_"+o.idx+"_container").find("iframe"),u=l;d.length&&d.each(function(){var a=this;t(a)&&(u=u.add(e(a).contents().find("body")))}),u.bind("mousewheel."+r,function(t,n){if(v(a),!a(a,t.target)){var r="auto"!==i.mousewheel.deltafactor?parseint(i.mousewheel.deltafactor):c&&t.deltafactor<100?100:t.deltafactor||100;if("x"===i.axis||"x"===i.mousewheel.axis)var d="x",u=[math.round(r*o.scrollratio.x),parseint(i.mousewheel.scrollamount)],f="auto"!==i.mousewheel.scrollamount?u[1]:u[0]>=l.width()?.9*l.width():u[0],h=math.abs(e("#mcsb_"+o.idx+"_container")[0].offsetleft),m=s[1][0].offsetleft,p=s[1].parent().width()-s[1].width(),g=t.deltax||t.deltay||n;else var d="y",u=[math.round(r*o.scrollratio.y),parseint(i.mousewheel.scrollamount)],f="auto"!==i.mousewheel.scrollamount?u[1]:u[0]>=l.height()?.9*l.height():u[0],h=math.abs(e("#mcsb_"+o.idx+"_container")[0].offsettop),m=s[0][0].offsettop,p=s[0].parent().height()-s[0].height(),g=t.deltay||n;"y"===d&&!o.overflowed[0]||"x"===d&&!o.overflowed[1]||(i.mousewheel.invert&&(g=-g),i.mousewheel.normalizedelta&&(g=0>g?-1:1),(g>0&&0!==m||0>g&&m!==p||i.mousewheel.preventdefault)&&(t.stopimmediatepropagation(),t.preventdefault()),q(a,(h-g*f).tostring(),{dir:d}))}})}},a=function(t,a){var o=a.nodename.tolowercase(),i=t.data(n).opt.mousewheel.disableover,r=["select","textarea"];return e.inarray(o,i)>-1&&!(e.inarray(o,r)>-1&&!e(a).is(":focus"))},p=function(){var t=e(this),a=t.data(n),o=n+"_"+a.idx,i=e("#mcsb_"+a.idx+"_container"),r=i.parent(),l=e(".mcsb_"+a.idx+"_scrollbar ."+u[12]);l.bind("touchstart."+o+" pointerdown."+o+" mspointerdown."+o,function(){d=!0}).bind("touchend."+o+" pointerup."+o+" mspointerup."+o,function(){d=!1}).bind("click."+o,function(o){if(e(o.target).hasclass(u[12])||e(o.target).hasclass("mcsb_draggerrail")){v(t);var n=e(this),l=n.find(".mcsb_dragger");if(n.parent(".mcsb_scrolltools_horizontal").length>0){if(!a.overflowed[1])return;var s="x",c=o.pagex>l.offset().left?-1:1,d=math.abs(i[0].offsetleft)-.9*c*r.width()}else{if(!a.overflowed[0])return;var s="y",c=o.pagey>l.offset().top?-1:1,d=math.abs(i[0].offsettop)-.9*c*r.height()}q(t,d.tostring(),{dir:s,scrolleasing:"mcseaseinout"})}})},z=function(){var t=e(this),o=t.data(n),i=o.opt,r=n+"_"+o.idx,l=e("#mcsb_"+o.idx+"_container"),s=l.parent();l.bind("focusin."+r,function(){var o=e(a.activeelement),n=l.find(".mcustomscrollbox").length,r=0;o.is(i.advanced.autoscrollonfocus)&&(v(t),cleartimeout(t[0]._focustimeout),t[0]._focustimer=n?(r+17)*n:0,t[0]._focustimeout=settimeout(function(){var e=[at(o)[0],at(o)[1]],a=[l[0].offsettop,l[0].offsetleft],n=[a[0]+e[0]>=0&&a[0]+e[0]=0&&a[0]+e[1]a");s.bind("mousedown."+r+" touchstart."+r+" pointerdown."+r+" mspointerdown."+r+" mouseup."+r+" touchend."+r+" pointerup."+r+" mspointerup."+r+" mouseout."+r+" pointerout."+r+" mspointerout."+r+" click."+r,function(n){function r(e,a){i.scrollamount=o.snapamount||o.scrollbuttons.scrollamount,q(t,e,a)}if(n.preventdefault(),$(n)){var l=e(this).attr("class");switch(i.type=o.scrollbuttons.scrolltype,n.type){case"mousedown":case"touchstart":case"pointerdown":case"mspointerdown":if("stepped"===i.type)return;d=!0,a.tweenrunning=!1,r("on",l);break;case"mouseup":case"touchend":case"pointerup":case"mspointerup":case"mouseout":case"pointerout":case"mspointerout":if("stepped"===i.type)return;d=!1,i.dir&&r("off",l);break;case"click":if("stepped"!==i.type||a.tweenrunning)return;r("on",l)}}})},f=function(){var t=e(this),o=t.data(n),i=o.opt,r=o.sequential,l=n+"_"+o.idx,s=e("#mcsb_"+o.idx),c=e("#mcsb_"+o.idx+"_container"),d=c.parent(),u="input,textarea,select,datalist,keygen,[contenteditable='true']";s.attr("tabindex","0").bind("blur."+l+" keydown."+l+" keyup."+l,function(n){function l(e,a){r.type=i.keyboard.scrolltype,r.scrollamount=i.snapamount||i.keyboard.scrollamount,"stepped"===r.type&&o.tweenrunning||q(t,e,a)}switch(n.type){case"blur":o.tweenrunning&&r.dir&&l("off",null);break;case"keydown":case"keyup":var s=n.keycode?n.keycode:n.which,f="on";if("x"!==i.axis&&(38===s||40===s)||"y"!==i.axis&&(37===s||39===s)){if((38===s||40===s)&&!o.overflowed[0]||(37===s||39===s)&&!o.overflowed[1])return;"keyup"===n.type&&(f="off"),e(a.activeelement).is(u)||(n.preventdefault(),n.stopimmediatepropagation(),l(f,s))}else if(33===s||34===s){if((o.overflowed[0]||o.overflowed[1])&&(n.preventdefault(),n.stopimmediatepropagation()),"keyup"===n.type){v(t);var h=34===s?-1:1;if("x"===i.axis||"yx"===i.axis&&o.overflowed[1]&&!o.overflowed[0])var m="x",p=math.abs(c[0].offsetleft)-.9*h*d.width();else var m="y",p=math.abs(c[0].offsettop)-.9*h*d.height();q(t,p.tostring(),{dir:m,scrolleasing:"mcseaseinout"})}}else if((35===s||36===s)&&!e(a.activeelement).is(u)&&((o.overflowed[0]||o.overflowed[1])&&(n.preventdefault(),n.stopimmediatepropagation()),"keyup"===n.type)){if("x"===i.axis||"yx"===i.axis&&o.overflowed[1]&&!o.overflowed[0])var m="x",p=35===s?math.abs(d.width()-c.outerwidth(!1)):0;else var m="y",p=35===s?math.abs(d.height()-c.outerheight(!1)):0;q(t,p.tostring(),{dir:m,scrolleasing:"mcseaseinout"})}}})},q=function(t,a,o,i,r){function l(e){var a="stepped"!==f.type,o=r?r:e?a?d.scrollinertia/1.5:d.scrollinertia:1e3/60,n=e?a?7.5:40:2.5,s=[math.abs(h[0].offsettop),math.abs(h[0].offsetleft)],u=[c.scrollratio.y>10?10:c.scrollratio.y,c.scrollratio.x>10?10:c.scrollratio.x],m="x"===f.dir[0]?s[1]+f.dir[1]*u[1]*n:s[0]+f.dir[1]*u[0]*n,p="x"===f.dir[0]?s[1]+f.dir[1]*parseint(f.scrollamount):s[0]+f.dir[1]*parseint(f.scrollamount),g="auto"!==f.scrollamount?p:m,v=i?i:e?a?"mcslinearout":"mcseaseinout":"mcslinear",x=e?!0:!1;return e&&17>o&&(g="x"===f.dir[0]?s[1]:s[0]),q(t,g.tostring(),{dir:f.dir[0],scrolleasing:v,dur:o,oncomplete:x}),e?void(f.dir=!1):(cleartimeout(f.step),void(f.step=settimeout(function(){l()},o)))}function s(){cleartimeout(f.step),z(f,"step"),v(t)}var c=t.data(n),d=c.opt,f=c.sequential,h=e("#mcsb_"+c.idx+"_container"),m="stepped"===f.type?!0:!1;switch(a){case"on":if(f.dir=[o===u[16]||o===u[15]||39===o||37===o?"x":"y",o===u[13]||o===u[15]||38===o||37===o?-1:1],v(t),tt(o)&&"stepped"===f.type)return;l(m);break;case"off":s(),(m||c.tweenrunning&&f.dir)&&l(!0)}},j=function(t){var a=e(this).data(n).opt,o=[];return"function"==typeof t&&(t=t()),t instanceof array?o=t.length>1?[t[0],t[1]]:"x"===a.axis?[null,t[0]]:[t[0],null]:(o[0]=t.y?t.y:t.x||"x"===a.axis?null:t,o[1]=t.x?t.x:t.y||"y"===a.axis?null:t),"function"==typeof o[0]&&(o[0]=o[0]()),"function"==typeof o[1]&&(o[1]=o[1]()),o},y=function(t,a){if(null!=t&&"undefined"!=typeof t){var o=e(this),i=o.data(n),r=i.opt,l=e("#mcsb_"+i.idx+"_container"),s=l.parent(),c=typeof t;a||(a="x"===r.axis?"x":"y");var d="x"===a?l.outerwidth(!1):l.outerheight(!1),u="x"===a?l[0].offsetleft:l[0].offsettop,h="x"===a?"left":"top";switch(c){case"function":return t();case"object":var m=t.jquery?t:e(t);if(!m.length)return;return"x"===a?at(m)[1]:at(m)[0];case"string":case"number":if(tt(t))return math.abs(t);if(-1!==t.indexof("%"))return math.abs(d*parseint(t)/100);if(-1!==t.indexof("-="))return math.abs(u-parseint(t.split("-=")[1]));if(-1!==t.indexof("+=")){var p=u+parseint(t.split("+=")[1]);return p>=0?0:math.abs(p)}if(-1!==t.indexof("px")&&tt(t.split("px")[0]))return math.abs(t.split("px")[0]);if("top"===t||"left"===t)return 0;if("bottom"===t)return math.abs(s.height()-l.outerheight(!1));if("right"===t)return math.abs(s.width()-l.outerwidth(!1));if("first"===t||"last"===t){var m=l.find(":"+t);return"x"===a?at(m)[1]:at(m)[0]}return e(t).length?"x"===a?at(e(t))[1]:at(e(t))[0]:(l.css(h,t),void f.update.call(null,o[0]))}}},x=function(t){function a(){cleartimeout(h[0].autoupdate),h[0].autoupdate=settimeout(function(){return d.advanced.updateonselectorchange&&(m=r(),m!==s)?(l(3),void(s=m)):(d.advanced.updateoncontentresize&&(p=[h.outerheight(!1),h.outerwidth(!1),v.height(),v.width(),_()[0],_()[1]],(p[0]!==w[0]||p[1]!==w[1]||p[2]!==w[2]||p[3]!==w[3]||p[4]!==w[4]||p[5]!==w[5])&&(l(p[0]!==w[0]||p[1]!==w[1]),w=p)),d.advanced.updateonimageload&&(g=o(),g!==b&&(h.find("img").each(function(){i(this)}),b=g)),void((d.advanced.updateonselectorchange||d.advanced.updateoncontentresize||d.advanced.updateonimageload)&&a()))},60)}function o(){var e=0;return d.advanced.updateonimageload&&(e=h.find("img").length),e}function i(t){function a(e,t){return function(){return t.apply(e,arguments)}}function o(){this.onload=null,e(t).addclass(u[2]),l(2)}if(e(t).hasclass(u[2]))return void l();var n=new image;n.onload=a(n,o),n.src=t.src}function r(){d.advanced.updateonselectorchange===!0&&(d.advanced.updateonselectorchange="*");var t=0,a=h.find(d.advanced.updateonselectorchange);return d.advanced.updateonselectorchange&&a.length>0&&a.each(function(){t+=e(this).height()+e(this).width()}),t}function l(e){cleartimeout(h[0].autoupdate),f.update.call(null,s[0],e)}var s=e(this),c=s.data(n),d=c.opt,h=e("#mcsb_"+c.idx+"_container");if(t)return cleartimeout(h[0].autoupdate),void z(h[0],"autoupdate");var m,p,g,v=h.parent(),x=[e("#mcsb_"+c.idx+"_scrollbar_vertical"),e("#mcsb_"+c.idx+"_scrollbar_horizontal")],_=function(){return[x[0].is(":visible")?x[0].outerheight(!0):0,x[1].is(":visible")?x[1].outerwidth(!0):0]},s=r(),w=[h.outerheight(!1),h.outerwidth(!1),v.height(),v.width(),_()[0],_()[1]],b=o();a()},n=function(e,t,a){return math.round(e/t)*t-a},v=function(t){var a=t.data(n),o=e("#mcsb_"+a.idx+"_container,#mcsb_"+a.idx+"_container_wrapper,#mcsb_"+a.idx+"_dragger_vertical,#mcsb_"+a.idx+"_dragger_horizontal");o.each(function(){k.call(this)})},q=function(t,a,o){function i(e){return s&&c.callbacks[e]&&"function"==typeof c.callbacks[e]}function r(){return[c.callbacks.alwaystriggeroffsets||_>=s[0]+b,c.callbacks.alwaystriggeroffsets||-c>=_]}function l(){var e=[h[0].offsettop,h[0].offsetleft],a=[v[0].offsettop,v[0].offsetleft],n=[h.outerheight(!1),h.outerwidth(!1)],i=[f.height(),f.width()];t[0].mcs={content:h,top:e[0],left:e[1],draggertop:a[0],draggerleft:a[1],toppct:math.round(100*math.abs(e[0])/(math.abs(n[0])-i[0])),leftpct:math.round(100*math.abs(e[1])/(math.abs(n[1])-i[1])),direction:o.dir}}var s=t.data(n),c=s.opt,d={trigger:"internal",dir:"y",scrolleasing:"mcseaseout",drag:!1,dur:c.scrollinertia,overwrite:"all",callbacks:!0,onstart:!0,onupdate:!0,oncomplete:!0},o=e.extend(d,o),u=[o.dur,o.drag?0:o.dur],f=e("#mcsb_"+s.idx),h=e("#mcsb_"+s.idx+"_container"),m=h.parent(),p=c.callbacks.ontotalscrolloffset?j.call(t,c.callbacks.ontotalscrolloffset):[0,0],g=c.callbacks.ontotalscrollbackoffset?j.call(t,c.callbacks.ontotalscrollbackoffset):[0,0];if(s.trigger=o.trigger,(0!==m.scrolltop()||0!==m.scrollleft())&&(e(".mcsb_"+s.idx+"_scrollbar").css("visibility","visible"),m.scrolltop(0).scrollleft(0)),"_resety"!==a||s.contentreset.y||(i("onoverflowynone")&&c.callbacks.onoverflowynone.call(t[0]),s.contentreset.y=1),"_resetx"!==a||s.contentreset.x||(i("onoverflowxnone")&&c.callbacks.onoverflowxnone.call(t[0]),s.contentreset.x=1),"_resety"!==a&&"_resetx"!==a){switch(!s.contentreset.y&&t[0].mcs||!s.overflowed[0]||(i("onoverflowy")&&c.callbacks.onoverflowy.call(t[0]),s.contentreset.x=null),!s.contentreset.x&&t[0].mcs||!s.overflowed[1]||(i("onoverflowx")&&c.callbacks.onoverflowx.call(t[0]),s.contentreset.x=null),c.snapamount&&(a=n(a,c.snapamount,c.snapoffset)),o.dir){case"x":var v=e("#mcsb_"+s.idx+"_dragger_horizontal"),x="left",_=h[0].offsetleft,s=[f.width()-h.outerwidth(!1),v.parent().width()-v.width()],w=[a,0===a?0:a/s.scrollratio.x],b=p[1],c=g[1],y=b>0?b/s.scrollratio.x:0,t=c>0?c/s.scrollratio.x:0;break; case"y":var v=e("#mcsb_"+s.idx+"_dragger_vertical"),x="top",_=h[0].offsettop,s=[f.height()-h.outerheight(!1),v.parent().height()-v.height()],w=[a,0===a?0:a/s.scrollratio.y],b=p[0],c=g[0],y=b>0?b/s.scrollratio.y:0,t=c>0?c/s.scrollratio.y:0}w[1]<0||0===w[0]&&0===w[1]?w=[0,0]:w[1]>=s[1]?w=[s[0],s[1]]:w[0]=-w[0],t[0].mcs||(l(),i("oninit")&&c.callbacks.oninit.call(t[0])),cleartimeout(h[0].oncompletetimeout),(s.tweenrunning||!(0===_&&w[0]>=0||_===s[0]&&w[0]<=s[0]))&&(g(v[0],x,math.round(w[1]),u[1],o.scrolleasing),g(h[0],x,math.round(w[0]),u[0],o.scrolleasing,o.overwrite,{onstart:function(){o.callbacks&&o.onstart&&!s.tweenrunning&&(i("onscrollstart")&&(l(),c.callbacks.onscrollstart.call(t[0])),s.tweenrunning=!0,b(v),s.cboffsets=r())},onupdate:function(){o.callbacks&&o.onupdate&&i("whilescrolling")&&(l(),c.callbacks.whilescrolling.call(t[0]))},oncomplete:function(){if(o.callbacks&&o.oncomplete){"yx"===c.axis&&cleartimeout(h[0].oncompletetimeout);var e=h[0].idletimer||0;h[0].oncompletetimeout=settimeout(function(){i("onscroll")&&(l(),c.callbacks.onscroll.call(t[0])),i("ontotalscroll")&&w[1]>=s[1]-y&&s.cboffsets[0]&&(l(),c.callbacks.ontotalscroll.call(t[0])),i("ontotalscrollback")&&w[1]<=t&&s.cboffsets[1]&&(l(),c.callbacks.ontotalscrollback.call(t[0])),s.tweenrunning=!1,h[0].idletimer=0,b(v,"hide")},e)}}}))}},g=function(e,a,o,n,i,r,l){function s(){b.stop||(_||p.call(),_=j()-x,c(),_>=b.time&&(b.time=_>b.time?_+h-(_-b.time):_+h-1,b.time<_+1&&(b.time=_+1)),b.time0?(b.currval=f(b.time,s,c,n,i),w[a]=math.round(b.currval)+"px"):w[a]=o+"px",g.call()}function d(){h=1e3/60,b.time=_+h,m=t.requestanimationframe?t.requestanimationframe:function(e){return c(),settimeout(e,.01)},b.id=m(s)}function u(){null!=b.id&&(t.requestanimationframe?t.cancelanimationframe(b.id):cleartimeout(b.id),b.id=null)}function f(e,t,a,o,n){switch(n){case"linear":case"mcslinear":return a*e/o+t;case"mcslinearout":return e/=o,e--,a*math.sqrt(1-e*e)+t;case"easeinoutsmooth":return e/=o/2,1>e?a/2*e*e+t:(e--,-a/2*(e*(e-2)-1)+t);case"easeinoutstrong":return e/=o/2,1>e?a/2*math.pow(2,10*(e-1))+t:(e--,a/2*(-math.pow(2,-10*e)+2)+t);case"easeinout":case"mcseaseinout":return e/=o/2,1>e?a/2*e*e*e+t:(e-=2,a/2*(e*e*e+2)+t);case"easeoutsmooth":return e/=o,e--,-a*(e*e*e*e-1)+t;case"easeoutstrong":return a*(-math.pow(2,-10*e/o)+1)+t;case"easeout":case"mcseaseout":default:var i=(e/=o)*e,r=i*e;return t+a*(.499999999999997*r*i+-2.5*i*i+5.5*r+-6.5*i+4*e)}}e._mtween||(e._mtween={top:{},left:{}});var h,m,l=l||{},p=l.onstart||function(){},g=l.onupdate||function(){},v=l.oncomplete||function(){},x=j(),_=0,s=e.offsettop,w=e.style,b=e._mtween[a];"left"===a&&(s=e.offsetleft);var c=o-s;b.stop=0,"none"!==r&&u(),d()},j=function(){return t.performance&&t.performance.now?t.performance.now():t.performance&&t.performance.webkitnow?t.performance.webkitnow():date.now?date.now():(new date).gettime()},k=function(){var e=this;e._mtween||(e._mtween={top:{},left:{}});for(var a=["top","left"],o=0;o=0&&o[0]+at(n)[0]=0&&o[1]+at(n)[1]