text: !function(b){function c(){var a=document.getElementsByTagName("script"),b=a[a.length-1].src.split("?")[0];return b.split("/").length>0?b.split("/").slice(0,-1).join("/")+"/":""}function d(a,b,c){for(var d=0;d<b.length;d++)c(a,b[d])}var e=!1,f=!1,g=5e3,h=2e3,i=0,j=b,k=c(),l=["ms","moz","webkit","o"],m=window.requestAnimationFrame||!1,n=window.cancelAnimationFrame||!1;if(!m)for(var o in l){var p=l[o];m||(m=window[p+"RequestAnimationFrame"]),n||(n=window[p+"CancelAnimationFrame"]||window[p+"CancelRequestAnimationFrame"])}var q=window.MutationObserver||window.WebKitMutationObserver||!1,r={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"5px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:24,touchbehavior:!1,hwacceleration:!0,usetransition:!0,boxzoom:!1,dblclickzoom:!0,gesturezoom:!0,grabcursorenabled:!0,autohidemode:!0,background:"",iframeautoresize:!0,cursorminheight:32,preservenativescrolling:!0,railoffset:!1,bouncescroll:!0,spacebarenabled:!0,railpadding:{top:0,right:0,left:0,bottom:0},disableoutline:!0,horizrailenabled:!0,railalign:"right",railvalign:"bottom",enabletranslate3d:!0,enablemousewheel:!0,enablekeyboard:!0,smoothscroll:!0,sensitiverail:!0,enablemouselockapi:!0,cursorfixedheight:!1,directionlockdeadzone:6,hidecursordelay:400,nativeparentscrolling:!0,enablescrollonselection:!0,overflowx:!0,overflowy:!0,cursordragspeed:.3,rtlmode:!1,cursordragontouch:!1,oneaxismousemode:"auto"},s=!1,t=function(){function a(){var a=["-moz-grab","-webkit-grab","grab"];(c.ischrome&&!c.ischrome22||c.isie)&&(a=[]);for(var d=0;d<a.length;d++){var e=a[d];if(b.style.cursor=e,b.style.cursor==e)return e}return"url(http://www.google.com/intl/en_ALL/mapfiles/openhand.cur),n-resize"}if(s)return s;var b=document.createElement("DIV"),c={};c.haspointerlock="pointerLockElement"in document||"mozPointerLockElement"in document||"webkitPointerLockElement"in document,c.isopera="opera"in window,c.isopera12=c.isopera&&"getUserMedia"in navigator,c.isoperamini="[object OperaMini]"===Object.prototype.toString.call(window.operamini),c.isie="all"in document&&"attachEvent"in b&&!c.isopera,c.isieold=c.isie&&!("msInterpolationMode"in b.style),c.isie7=c.isie&&!c.isieold&&(!("documentMode"in document)||7==document.documentMode),c.isie8=c.isie&&"documentMode"in document&&8==document.documentMode,c.isie9=c.isie&&"performance"in window&&document.documentMode>=9,c.isie10=c.isie&&"performance"in window&&document.documentMode>=10,c.isie9mobile=/iemobile.9/i.test(navigator.userAgent),c.isie9mobile&&(c.isie9=!1),c.isie7mobile=!c.isie9mobile&&c.isie7&&/iemobile/i.test(navigator.userAgent),c.ismozilla="MozAppearance"in b.style,c.iswebkit="WebkitAppearance"in b.style,c.ischrome="chrome"in window,c.ischrome22=c.ischrome&&c.haspointerlock,c.ischrome26=c.ischrome&&"transition"in b.style,c.cantouch="ontouchstart"in document.documentElement||"ontouchstart"in window,c.hasmstouch=window.navigator.msPointerEnabled||!1,c.ismac=/^mac$/i.test(navigator.platform),c.isios=c.cantouch&&/iphone|ipad|ipod/i.test(navigator.platform),c.isios4=c.isios&&!("seal"in Object),c.isandroid=/android/i.test(navigator.userAgent),c.trstyle=!1,c.hastransform=!1,c.hastranslate3d=!1,c.transitionstyle=!1,c.hastransition=!1,c.transitionend=!1;for(var d=["transform","msTransform","webkitTransform","MozTransform","OTransform"],e=0;e<d.length;e++)if("undefined"!=typeof b.style[d[e]]){c.trstyle=d[e];break}c.hastransform=0!=c.trstyle,c.hastransform&&(b.style[c.trstyle]="translate3d(1px,2px,3px)",c.hastranslate3d=/translate3d/.test(b.style[c.trstyle])),c.transitionstyle=!1,c.prefixstyle="",c.transitionend=!1;for(var d=["transition","webkitTransition","MozTransition","OTransition","OTransition","msTransition","KhtmlTransition"],f=["","-webkit-","-moz-","-o-","-o","-ms-","-khtml-"],g=["transitionend","webkitTransitionEnd","transitionend","otransitionend","oTransitionEnd","msTransitionEnd","KhtmlTransitionEnd"],e=0;e<d.length;e++)if(d[e]in b.style){c.transitionstyle=d[e],c.prefixstyle=f[e],c.transitionend=g[e];break}return c.ischrome26&&(c.prefixstyle=f[1]),c.hastransition=c.transitionstyle,c.cursorgrabvalue=a(),c.hasmousecapture="setCapture"in b,c.hasMutationObserver=q!==!1,b=null,s=c,c},u=function(a,b){function c(){var a=s.doc.css(w.trstyle);return a&&"matrix"==a.substr(0,6)?a.replace(/^.*\((.*)\)$/g,"$1").replace(/px/g,"").split(/, +/):!1}function d(){var a=s.win;if("zIndex"in a)return a.zIndex();for(;a.length>0;){if(9==a[0].nodeType)return!1;var b=a.css("zIndex");if(!isNaN(b)&&0!=b)return parseInt(b);a=a.parent()}return!1}function l(a,b,c){var d=a.css(b),e=parseFloat(d);if(isNaN(e)){e=x[d]||0;var f=3==e?c?s.win.outerHeight()-s.win.innerHeight():s.win.outerWidth()-s.win.innerWidth():1;return s.isie8&&e&&(e+=1),f?e:0}return e}function o(a,b,c,d){s._bind(a,b,function(d){var d=d?d:window.event,e={original:d,target:d.target||d.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==d.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return d.preventDefault?d.preventDefault():d.returnValue=!1,!1},stopImmediatePropagation:function(){d.stopImmediatePropagation?d.stopImmediatePropagation():d.cancelBubble=!0}};return"mousewheel"==b?(e.deltaY=-1/40*d.wheelDelta,d.wheelDeltaX&&(e.deltaX=-1/40*d.wheelDeltaX)):e.deltaY=d.detail,c.call(a,e)},d)}function p(a,b,c){var d,e;if(0==a.deltaMode?(d=-Math.floor(a.deltaX*(s.opt.mousescrollstep/54)),e=-Math.floor(a.deltaY*(s.opt.mousescrollstep/54))):1==a.deltaMode&&(d=-Math.floor(a.deltaX*s.opt.mousescrollstep),e=-Math.floor(a.deltaY*s.opt.mousescrollstep)),b&&s.opt.oneaxismousemode&&0==d&&e&&(d=e,e=0),d&&(s.scrollmom&&s.scrollmom.stop(),s.lastdeltax+=d,s.debounced("mousewheelx",function(){var a=s.lastdeltax;s.lastdeltax=0,s.rail.drag||s.doScrollLeftBy(a)},120)),e){if(s.opt.nativeparentscrolling&&c&&!s.ispage&&!s.zoomactive)if(0>e){if(s.getScrollTop()>=s.page.maxh)return!0}else if(s.getScrollTop()<=0)return!0;s.scrollmom&&s.scrollmom.stop(),s.lastdeltay+=e,s.debounced("mousewheely",function(){var a=s.lastdeltay;s.lastdeltay=0,s.rail.drag||s.doScrollBy(a)},120)}return a.stopImmediatePropagation(),a.preventDefault()}var s=this;if(this.version="3.5.0 BETA5",this.name="nicescroll",this.me=b,this.opt={doc:j("body"),win:!1},j.extend(this.opt,r),this.opt.snapbackspeed=80,a)for(var u in s.opt)"undefined"!=typeof a[u]&&(s.opt[u]=a[u]);this.doc=s.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/BODY|HTML/.test(s.opt.win?s.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=s.opt.win!==!1,this.win=s.opt.win||(this.ispage?j(window):this.doc),this.docscroll=this.ispage&&!this.haswrapper?j(window):this.win,this.body=j("body"),this.viewport=!1,this.isfixed=!1,this.iframe=!1,this.isiframe="IFRAME"==this.doc[0].nodeName&&"IFRAME"==this.win[0].nodeName,this.istextarea="TEXTAREA"==this.win[0].nodeName,this.forcescreen=!1,this.canshowonmouseevent="scroll"!=s.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,this.checkrtlmode=!1,this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1;do this.id="ascrail"+h++;while(document.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.overflowx=s.opt.overflowx,this.overflowy=s.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=t();var w=j.extend({},this.detected);this.canhwscroll=w.hastransform&&s.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&s.haswrapper,this.istouchcapable=!1,w.cantouch&&w.ischrome&&!w.isios&&!w.isandroid&&(this.istouchcapable=!0,w.cantouch=!1),w.cantouch&&w.ismozilla&&!w.isios&&!w.isandroid&&(this.istouchcapable=!0,w.cantouch=!1),s.opt.enablemouselockapi||(w.hasmousecapture=!1,w.haspointerlock=!1),this.delayed=function(a,b,c,d){var e=s.delaylist[a],f=(new Date).getTime();return!d&&e&&e.tt?!1:(e&&e.tt&&clearTimeout(e.tt),void(e&&e.last+c>f&&!e.tt?s.delaylist[a]={last:f+c,tt:setTimeout(function(){s.delaylist[a].tt=0,b.call()},c)}:e&&e.tt||(s.delaylist[a]={last:f,tt:0},setTimeout(function(){b.call()},0))))},this.debounced=function(a,b,c){var d=s.delaylist[a];(new Date).getTime();s.delaylist[a]=b,d||setTimeout(function(){var b=s.delaylist[a];s.delaylist[a]=!1,b.call()},c)},this.synched=function(a,b){function c(){s.onsync||(m(function(){s.onsync=!1;for(a in s.synclist){var b=s.synclist[a];b&&b.call(s),s.synclist[a]=!1}}),s.onsync=!0)}return s.synclist[a]=b,c(),a},this.unsynched=function(a){s.synclist[a]&&(s.synclist[a]=!1)},this.css=function(a,b){for(var c in b)s.saved.css.push([a,c,a.css(c)]),a.css(c,b[c])},this.scrollTop=function(a){return"undefined"==typeof a?s.getScrollTop():s.setScrollTop(a)},this.scrollLeft=function(a){return"undefined"==typeof a?s.getScrollLeft():s.setScrollLeft(a)},BezierClass=function(a,b,c,d,e,f,g){this.st=a,this.ed=b,this.spd=c,this.p1=d||0,this.p2=e||1,this.p3=f||0,this.p4=g||1,this.ts=(new Date).getTime(),this.df=this.ed-this.st},BezierClass.prototype={B2:function(a){return 3*a*a*(1-a)},B3:function(a){return 3*a*(1-a)*(1-a)},B4:function(a){return(1-a)*(1-a)*(1-a)},getNow:function(){var a=(new Date).getTime(),b=1-(a-this.ts)/this.spd,c=this.B2(b)+this.B3(b)+this.B4(b);return 0>b?this.ed:this.st+Math.round(this.df*c)},update:function(a,b){return this.st=this.getNow(),this.ed=a,this.spd=b,this.ts=(new Date).getTime(),this.df=this.ed-this.st,this}},this.ishwscroll?(this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},w.hastranslate3d&&w.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(a){if(!a){var b=c();if(b)return 16==b.length?-b[13]:-b[5];if(s.timerscroll&&s.timerscroll.bz)return s.timerscroll.bz.getNow()}return s.doc.translate.y},this.getScrollLeft=function(a){if(!a){var b=c();if(b)return 16==b.length?-b[12]:-b[4];if(s.timerscroll&&s.timerscroll.bh)return s.timerscroll.bh.getNow()}return s.doc.translate.x},document.createEvent?this.notifyScrollEvent=function(a){var b=document.createEvent("UIEvents");b.initUIEvent("scroll",!1,!0,window,1),a.dispatchEvent(b)}:document.fireEvent?this.notifyScrollEvent=function(a){var b=document.createEventObject();a.fireEvent("onscroll"),b.cancelBubble=!0}:this.notifyScrollEvent=function(a,b){},w.hastranslate3d&&s.opt.enabletranslate3d?(this.setScrollTop=function(a,b){s.doc.translate.y=a,s.doc.translate.ty=-1*a+"px",s.doc.css(w.trstyle,"translate3d("+s.doc.translate.tx+","+s.doc.translate.ty+",0px)"),b||s.notifyScrollEvent(s.win[0])},this.setScrollLeft=function(a,b){s.doc.translate.x=a,s.doc.translate.tx=-1*a+"px",s.doc.css(w.trstyle,"translate3d("+s.doc.translate.tx+","+s.doc.translate.ty+",0px)"),b||s.notifyScrollEvent(s.win[0])}):(this.setScrollTop=function(a,b){s.doc.translate.y=a,s.doc.translate.ty=-1*a+"px",s.doc.css(w.trstyle,"translate("+s.doc.translate.tx+","+s.doc.translate.ty+")"),b||s.notifyScrollEvent(s.win[0])},this.setScrollLeft=function(a,b){s.doc.translate.x=a,s.doc.translate.tx=-1*a+"px",s.doc.css(w.trstyle,"translate("+s.doc.translate.tx+","+s.doc.translate.ty+")"),b||s.notifyScrollEvent(s.win[0])})):(this.getScrollTop=function(){return s.docscroll.scrollTop()},this.setScrollTop=function(a){return s.docscroll.scrollTop(a)},this.getScrollLeft=function(){return s.docscroll.scrollLeft()},this.setScrollLeft=function(a){return s.docscroll.scrollLeft(a)}),this.getTarget=function(a){return a?a.target?a.target:a.srcElement?a.srcElement:!1:!1},this.hasParent=function(a,b){if(!a)return!1;for(var c=a.target||a.srcElement||a||!1;c&&c.id!=b;)c=c.parentNode||!1;return c!==!1};var x={thin:1,medium:3,thick:5};this.getOffset=function(){if(s.isfixed)return{top:parseFloat(s.win.css("top")),left:parseFloat(s.win.css("left"))};if(!s.viewport)return s.win.offset();var a=s.win.offset(),b=s.viewport.offset();return{top:a.top-b.top+s.viewport.scrollTop(),left:a.left-b.left+s.viewport.scrollLeft()}},this.updateScrollBar=function(a){if(s.ishwscroll)s.rail.css({height:s.win.innerHeight()}),s.railh&&s.railh.css({width:s.win.innerWidth()});else{var b=s.getOffset(),c={top:b.top,left:b.left};c.top+=l(s.win,"border-top-width",!0);(s.win.outerWidth()-s.win.innerWidth())/2;c.left+=s.rail.align?s.win.outerWidth()-l(s.win,"border-right-width")-s.rail.width:l(s.win,"border-left-width");var d=s.opt.railoffset;if(d&&(d.top&&(c.top+=d.top),s.rail.align&&d.left&&(c.left+=d.left)),s.locked||s.rail.css({top:c.top,left:c.left,height:a?a.h:s.win.innerHeight()}),s.zoom&&s.zoom.css({top:c.top+1,left:1==s.rail.align?c.left-20:c.left+s.rail.width+4}),s.railh&&!s.locked){var c={top:b.top,left:b.left},e=s.railh.align?c.top+l(s.win,"border-top-width",!0)+s.win.innerHeight()-s.railh.height:c.top+l(s.win,"border-top-width",!0),f=c.left+l(s.win,"border-left-width");s.railh.css({top:e,left:f,width:s.railh.width})}}},this.doRailClick=function(a,b,c){var d,e,f,g;s.locked||(s.cancelEvent(a),b?(d=c?s.doScrollLeft:s.doScrollTop,f=c?(a.pageX-s.railh.offset().left-s.cursorwidth/2)*s.scrollratio.x:(a.pageY-s.rail.offset().top-s.cursorheight/2)*s.scrollratio.y,d(f)):(d=c?s.doScrollLeftBy:s.doScrollBy,f=c?s.scroll.x:s.scroll.y,g=c?a.pageX-s.railh.offset().left:a.pageY-s.rail.offset().top,e=c?s.view.w:s.view.h,d(f>=g?e:-e)))},s.hasanimationframe=m,s.hascancelanimationframe=n,s.hasanimationframe?s.hascancelanimationframe||(n=function(){s.cancelAnimationFrame=!0}):(m=function(a){return setTimeout(a,15-Math.floor(+new Date/1e3)%16)},n=clearInterval),this.init=function(){function a(b){if(s.selectiondrag){if(b){var c=s.win.outerHeight(),d=b.pageY-s.selectiondrag.top;d>0&&c>d&&(d=0),d>=c&&(d-=c),s.selectiondrag.df=d}if(0!=s.selectiondrag.df){var e=2*-Math.floor(s.selectiondrag.df/6);s.doScrollBy(e),s.debounced("doselectionscroll",function(){a()},50)}}}function b(a){s.iframexd=!1;try{var b="contentDocument"in this?this.contentDocument:this.contentWindow.document;b.domain}catch(a){s.iframexd=!0,b=!1}if(s.iframexd)return"console"in window&&console.log("NiceScroll error: policy restriced iframe"),!0;if(s.forcescreen=!0,s.isiframe&&(s.iframe={doc:j(b),html:s.doc.contents().find("html")[0],body:s.doc.contents().find("body")[0]},s.getContentSize=function(){return{w:Math.max(s.iframe.html.scrollWidth,s.iframe.body.scrollWidth),h:Math.max(s.iframe.html.scrollHeight,s.iframe.body.scrollHeight)}},s.docscroll=j(s.iframe.body)),!w.isios&&s.opt.iframeautoresize&&!s.isiframe){s.win.scrollTop(0),s.doc.height("");var c=Math.max(b.getElementsByTagName("html")[0].scrollHeight,b.body.scrollHeight);s.doc.height(c)}s.lazyResize(30),w.isie7&&s.css(j(s.iframe.html),{"overflow-y":"hidden"}),s.css(j(s.iframe.body),{"overflow-y":"hidden"}),w.isios&&s.haswrapper&&(s.css(j(b.body),{"-webkit-transform":"translate3d(0,0,0)"}),console.log(1)),"contentWindow"in this?s.bind(this.contentWindow,"scroll",s.onscroll):s.bind(b,"scroll",s.onscroll),s.opt.enablemousewheel&&s.bind(b,"mousewheel",s.onmousewheel),s.opt.enablekeyboard&&s.bind(b,w.isopera?"keypress":"keydown",s.onkeypress),(w.cantouch||s.opt.touchbehavior)&&(s.bind(b,"mousedown",s.ontouchstart),s.bind(b,"mousemove",function(a){s.ontouchmove(a,!0)}),s.opt.grabcursorenabled&&w.cursorgrabvalue&&s.css(j(b.body),{cursor:w.cursorgrabvalue})),s.bind(b,"mouseup",s.ontouchend),s.zoom&&(s.opt.dblclickzoom&&s.bind(b,"dblclick",s.doZoom),s.ongesturezoom&&s.bind(b,"gestureend",s.ongesturezoom))}if(s.saved.css=[],w.isie7mobile)return!0;if(w.isoperamini)return!0;if(w.hasmstouch&&s.css(s.ispage?j("html"):s.win,{"-ms-touch-action":"none"}),s.zindex="auto",s.ispage||"auto"!=s.opt.zindex?s.zindex=s.opt.zindex:s.zindex=d()||"auto",s.ispage||"auto"==s.zindex||s.zindex>i&&(i=s.zindex),s.isie&&0==s.zindex&&"auto"==s.opt.zindex&&(s.zindex="auto"),!s.ispage||!w.cantouch&&!w.isieold&&!w.isie9mobile){var c=s.docscroll;s.ispage&&(c=s.haswrapper?s.win:s.doc),w.isie9mobile||s.css(c,{"overflow-y":"hidden"}),s.ispage&&w.isie7&&("BODY"==s.doc[0].nodeName?s.css(j("html"),{"overflow-y":"hidden"}):"HTML"==s.doc[0].nodeName&&s.css(j("body"),{"overflow-y":"hidden"})),!w.isios||s.ispage||s.haswrapper||s.css(j("body"),{"-webkit-overflow-scrolling":"touch"});var h=j(document.createElement("div"));h.css({position:"relative",top:0,"float":"right",width:s.opt.cursorwidth,height:"0px","background-color":s.opt.cursorcolor,border:s.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":s.opt.cursorborderradius,"-moz-border-radius":s.opt.cursorborderradius,"border-radius":s.opt.cursorborderradius}),h.hborder=parseFloat(h.outerHeight()-h.innerHeight()),s.cursor=h;var l=j(document.createElement("div"));l.attr("id",s.id),l.addClass("nicescroll-rails");var m,n,o=["left","right"];for(var p in o)n=o[p],m=s.opt.railpadding[n],m?l.css("padding-"+n,m+"px"):s.opt.railpadding[n]=0;l.append(h),l.width=Math.max(parseFloat(s.opt.cursorwidth),h.outerWidth())+s.opt.railpadding.left+s.opt.railpadding.right,l.css({width:l.width+"px",zIndex:s.zindex,background:s.opt.background,cursor:"default"}),l.visibility=!0,l.scrollable=!0,l.align="left"==s.opt.railalign?0:1,s.rail=l,s.rail.drag=!1;var r=!1;if(!s.opt.boxzoom||s.ispage||w.isieold||(r=document.createElement("div"),s.bind(r,"click",s.doZoom),s.zoom=j(r),s.zoom.css({cursor:"pointer","z-index":s.zindex,backgroundImage:"url("+k+"zoomico.png)",height:18,width:18,backgroundPosition:"0px 0px"}),s.opt.dblclickzoom&&s.bind(s.win,"dblclick",s.doZoom),w.cantouch&&s.opt.gesturezoom&&(s.ongesturezoom=function(a){return a.scale>1.5&&s.doZoomIn(a),a.scale<.8&&s.doZoomOut(a),s.cancelEvent(a)},s.bind(s.win,"gestureend",s.ongesturezoom))),s.railh=!1,s.opt.horizrailenabled){s.css(c,{"overflow-x":"hidden"});var h=j(document.createElement("div"));h.css({position:"relative",top:0,height:s.opt.cursorwidth,width:"0px","background-color":s.opt.cursorcolor,border:s.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":s.opt.cursorborderradius,"-moz-border-radius":s.opt.cursorborderradius,"border-radius":s.opt.cursorborderradius}),h.wborder=parseFloat(h.outerWidth()-h.innerWidth()),s.cursorh=h;var t=j(document.createElement("div"));t.attr("id",s.id+"-hr"),t.addClass("nicescroll-rails"),t.height=Math.max(parseFloat(s.opt.cursorwidth),h.outerHeight()),t.css({height:t.height+"px",zIndex:s.zindex,background:s.opt.background}),t.append(h),t.visibility=!0,t.scrollable=!0,t.align="top"==s.opt.railvalign?0:1,s.railh=t,s.railh.drag=!1}if(s.ispage)l.css({position:"fixed",top:"0px",height:"100%"}),l.align?l.css({right:"0px"}):l.css({left:"0px"}),s.body.append(l),s.railh&&(t.css({position:"fixed",left:"0px",width:"100%"}),t.align?t.css({bottom:"0px"}):t.css({top:"0px"}),s.body.append(t));else{if(s.ishwscroll){"static"==s.win.css("position")&&s.css(s.win,{position:"relative"});var u="HTML"==s.win[0].nodeName?s.body:s.win;s.zoom&&(s.zoom.css({position:"absolute",top:1,right:0,"margin-right":l.width+4}),u.append(s.zoom)),l.css({position:"absolute",top:0}),l.align?l.css({right:0}):l.css({left:0}),u.append(l),t&&(t.css({position:"absolute",left:0,bottom:0}),t.align?t.css({bottom:0}):t.css({top:0}),u.append(t))}else{s.isfixed="fixed"==s.win.css("position");var x=s.isfixed?"fixed":"absolute";s.isfixed||(s.viewport=s.getViewport(s.win[0])),s.viewport&&(s.body=s.viewport,0==/relative|absolute/.test(s.viewport.css("position"))&&s.css(s.viewport,{position:"relative"})),l.css({position:x}),s.zoom&&s.zoom.css({position:x}),s.updateScrollBar(),s.body.append(l),s.zoom&&s.body.append(s.zoom),s.railh&&(t.css({position:x}),s.body.append(t))}w.isios&&s.css(s.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),w.isie&&s.opt.disableoutline&&s.win.attr("hideFocus","true"),w.iswebkit&&s.opt.disableoutline&&s.win.css({outline:"none"})}if(s.opt.autohidemode===!1?(s.autohidedom=!1,s.rail.css({opacity:s.opt.cursoropacitymax}),s.railh&&s.railh.css({opacity:s.opt.cursoropacitymax})):s.opt.autohidemode===!0?(s.autohidedom=j().add(s.rail),w.isie8&&(s.autohidedom=s.autohidedom.add(s.cursor)),s.railh&&(s.autohidedom=s.autohidedom.add(s.railh)),s.railh&&w.isie8&&(s.autohidedom=s.autohidedom.add(s.cursorh))):"scroll"==s.opt.autohidemode?(s.autohidedom=j().add(s.rail),s.railh&&(s.autohidedom=s.autohidedom.add(s.railh))):"cursor"==s.opt.autohidemode?(s.autohidedom=j().add(s.cursor),s.railh&&(s.autohidedom=s.autohidedom.add(s.cursorh))):"hidden"==s.opt.autohidemode&&(s.autohidedom=!1,s.hide(),s.locked=!1),w.isie9mobile){s.scrollmom=new v(s),s.onmangotouch=function(a){var b=s.getScrollTop(),c=s.getScrollLeft();if(b==s.scrollmom.lastscrolly&&c==s.scrollmom.lastscrollx)return!0;var d=b-s.mangotouch.sy,e=c-s.mangotouch.sx,f=Math.round(Math.sqrt(Math.pow(e,2)+Math.pow(d,2)));if(0!=f){var g=0>d?-1:1,h=0>e?-1:1,i=+new Date;if(s.mangotouch.lazy&&clearTimeout(s.mangotouch.lazy),i-s.mangotouch.tm>80||s.mangotouch.dry!=g||s.mangotouch.drx!=h)s.scrollmom.stop(),s.scrollmom.reset(c,b),s.mangotouch.sy=b,s.mangotouch.ly=b,s.mangotouch.sx=c,s.mangotouch.lx=c,s.mangotouch.dry=g,s.mangotouch.drx=h,s.mangotouch.tm=i;else{s.scrollmom.stop(),s.scrollmom.update(s.mangotouch.sx-e,s.mangotouch.sy-d);i-s.mangotouch.tm;s.mangotouch.tm=i;var j=Math.max(Math.abs(s.mangotouch.ly-b),Math.abs(s.mangotouch.lx-c));s.mangotouch.ly=b,s.mangotouch.lx=c,j>2&&(s.mangotouch.lazy=setTimeout(function(){s.mangotouch.lazy=!1,s.mangotouch.dry=0,s.mangotouch.drx=0,s.mangotouch.tm=0,s.scrollmom.doMomentum(30)},100))}}};var y=s.getScrollTop(),z=s.getScrollLeft();s.mangotouch={sy:y,ly:y,dry:0,sx:z,lx:z,drx:0,lazy:!1,tm:0},s.bind(s.docscroll,"scroll",s.onmangotouch)}else{if(w.cantouch||s.istouchcapable||s.opt.touchbehavior||w.hasmstouch){s.scrollmom=new v(s),s.ontouchstart=function(a){if(a.pointerType&&2!=a.pointerType)return!1;if(!s.locked){if(w.hasmstouch)for(var b=a.target?a.target:!1;b;){var c=j(b).getNiceScroll();if(c.length>0&&c[0].me==s.me)break;if(c.length>0)return!1;if("DIV"==b.nodeName&&b.id==s.id)break;b=b.parentNode?b.parentNode:!1}s.cancelScroll();var b=s.getTarget(a);if(b){var d=/INPUT/i.test(b.nodeName)&&/range/i.test(b.type);if(d)return s.stopPropagation(a)}if(!("clientX"in a)&&"changedTouches"in a&&(a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY),s.forcescreen){var e=a,a={original:a.original?a.original:a};a.clientX=e.screenX,a.clientY=e.screenY}if(s.rail.drag={x:a.clientX,y:a.clientY,sx:s.scroll.x,sy:s.scroll.y,st:s.getScrollTop(),sl:s.getScrollLeft(),pt:2,dl:!1},s.ispage||!s.opt.directionlockdeadzone)s.rail.drag.dl="f";else{var f={w:j(window).width(),h:j(window).height()},g={w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},h=Math.max(0,g.h-f.h),i=Math.max(0,g.w-f.w);!s.rail.scrollable&&s.railh.scrollable?s.rail.drag.ck=h>0?"v":!1:s.rail.scrollable&&!s.railh.scrollable?s.rail.drag.ck=i>0?"h":!1:s.rail.drag.ck=!1,s.rail.drag.ck||(s.rail.drag.dl="f")}if(s.opt.touchbehavior&&s.isiframe&&w.isie){var k=s.win.position();s.rail.drag.x+=k.left,s.rail.drag.y+=k.top}if(s.hasmoving=!1,s.lastmouseup=!1,s.scrollmom.reset(a.clientX,a.clientY),!w.cantouch&&!this.istouchcapable&&!w.hasmstouch){var l=b?/INPUT|SELECT|TEXTAREA/i.test(b.nodeName):!1;if(!l)return!s.ispage&&w.hasmousecapture&&b.setCapture(),s.opt.touchbehavior?s.cancelEvent(a):s.stopPropagation(a);/SUBMIT|CANCEL|BUTTON/i.test(j(b).attr("type"))&&(pc={tg:b,click:!1},s.preventclick=pc)}}},s.ontouchend=function(a){return a.pointerType&&2!=a.pointerType?!1:s.rail.drag&&2==s.rail.drag.pt&&(s.scrollmom.doMomentum(),s.rail.drag=!1,s.hasmoving&&(s.hasmoving=!1,s.lastmouseup=!0,s.hideCursor(),w.hasmousecapture&&document.releaseCapture(),!w.cantouch))?s.cancelEvent(a):void 0};var A=s.opt.touchbehavior&&s.isiframe&&!w.hasmousecapture;s.ontouchmove=function(a,b){if(a.pointerType&&2!=a.pointerType)return!1;if(s.rail.drag&&2==s.rail.drag.pt){if(w.cantouch&&"undefined"==typeof a.original)return!0;s.hasmoving=!0,s.preventclick&&!s.preventclick.click&&(s.preventclick.click=s.preventclick.tg.onclick||!1,s.preventclick.tg.onclick=s.onpreventclick);var c=j.extend({original:a},a);if(a=c,"changedTouches"in a&&(a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY),s.forcescreen){var d=a,a={original:a.original?a.original:a};a.clientX=d.screenX,a.clientY=d.screenY}var e=ofy=0;if(A&&!b){var f=s.win.position();e=-f.left,ofy=-f.top}var g=a.clientY+ofy,h=g-s.rail.drag.y,i=a.clientX+e,k=i-s.rail.drag.x,l=s.rail.drag.st-h;if(s.ishwscroll&&s.opt.bouncescroll?0>l?l=Math.round(l/2):l>s.page.maxh&&(l=s.page.maxh+Math.round((l-s.page.maxh)/2)):(0>l&&(l=0,g=0),l>s.page.maxh&&(l=s.page.maxh,g=0)),s.railh&&s.railh.scrollable){var m=s.rail.drag.sl-k;s.ishwscroll&&s.opt.bouncescroll?0>m?m=Math.round(m/2):m>s.page.maxw&&(m=s.page.maxw+Math.round((m-s.page.maxw)/2)):(0>m&&(m=0,i=0),m>s.page.maxw&&(m=s.page.maxw,i=0))}var n=!1;if(s.rail.drag.dl)n=!0,"v"==s.rail.drag.dl?m=s.rail.drag.sl:"h"==s.rail.drag.dl&&(l=s.rail.drag.st);else{var o=Math.abs(h),p=Math.abs(k),q=s.opt.directionlockdeadzone;if("v"==s.rail.drag.ck){if(o>q&&.3*o>=p)return s.rail.drag=!1,!0;p>q&&(s.rail.drag.dl="f",j("body").scrollTop(j("body").scrollTop()))}else if("h"==s.rail.drag.ck){if(p>q&&.3*p>=o)return s.rail.drag=!1,!0;o>q&&(s.rail.drag.dl="f",j("body").scrollLeft(j("body").scrollLeft()))}}if(s.synched("touchmove",function(){s.rail.drag&&2==s.rail.drag.pt&&(s.prepareTransition&&s.prepareTransition(0),s.rail.scrollable&&s.setScrollTop(l),s.scrollmom.update(i,g),s.railh&&s.railh.scrollable?(s.setScrollLeft(m),s.showCursor(l,m)):s.showCursor(l),w.isie10&&document.selection.clear())}),w.ischrome&&s.istouchcapable&&(n=!1),n)return s.cancelEvent(a)}}}s.onmousedown=function(a,b){if(!s.rail.drag||1==s.rail.drag.pt){if(s.locked)return s.cancelEvent(a);s.cancelScroll(),s.rail.drag={x:a.clientX,y:a.clientY,sx:s.scroll.x,sy:s.scroll.y,pt:1,hr:!!b};var c=s.getTarget(a);return!s.ispage&&w.hasmousecapture&&c.setCapture(),s.isiframe&&!w.hasmousecapture&&(s.saved.csspointerevents=s.doc.css("pointer-events"),s.css(s.doc,{"pointer-events":"none"})),s.cancelEvent(a)}},s.onmouseup=function(a){if(s.rail.drag){if(w.hasmousecapture&&document.releaseCapture(),s.isiframe&&!w.hasmousecapture&&s.doc.css("pointer-events",s.saved.csspointerevents),1!=s.rail.drag.pt)return;return s.rail.drag=!1,s.cancelEvent(a)}},s.onmousemove=function(a){if(s.rail.drag){if(1!=s.rail.drag.pt)return;if(w.ischrome&&0==a.which)return s.onmouseup(a);if(s.cursorfreezed=!0,s.rail.drag.hr){s.scroll.x=s.rail.drag.sx+(a.clientX-s.rail.drag.x),s.scroll.x<0&&(s.scroll.x=0);var b=s.scrollvaluemaxw;s.scroll.x>b&&(s.scroll.x=b)}else{s.scroll.y=s.rail.drag.sy+(a.clientY-s.rail.drag.y),s.scroll.y<0&&(s.scroll.y=0);var c=s.scrollvaluemax;s.scroll.y>c&&(s.scroll.y=c)}return s.synched("mousemove",function(){s.rail.drag&&1==s.rail.drag.pt&&(s.showCursor(),s.rail.drag.hr?s.doScrollLeft(Math.round(s.scroll.x*s.scrollratio.x),s.opt.cursordragspeed):s.doScrollTop(Math.round(s.scroll.y*s.scrollratio.y),s.opt.cursordragspeed))}),s.cancelEvent(a)}},w.cantouch||s.opt.touchbehavior?(s.onpreventclick=function(a){return s.preventclick?(s.preventclick.tg.onclick=s.preventclick.click,s.preventclick=!1,s.cancelEvent(a)):void 0},s.bind(s.win,"mousedown",s.ontouchstart),s.onclick=w.isios?!1:function(a){return s.lastmouseup?(s.lastmouseup=!1,s.cancelEvent(a)):!0},s.opt.grabcursorenabled&&w.cursorgrabvalue&&(s.css(s.ispage?s.doc:s.win,{cursor:w.cursorgrabvalue}),s.css(s.rail,{cursor:w.cursorgrabvalue}))):("getSelection"in document?s.hasTextSelected=function(){return document.getSelection().rangeCount>0}:"selection"in document?s.hasTextSelected=function(){return"None"!=document.selection.type}:s.hasTextSelected=function(){return!1},s.onselectionstart=function(a){s.ispage||(s.selectiondrag=s.win.offset())},s.onselectionend=function(a){s.selectiondrag=!1},s.onselectiondrag=function(b){s.selectiondrag&&s.hasTextSelected()&&s.debounced("selectionscroll",function(){a(b)},250)}),w.hasmstouch&&(s.css(s.rail,{"-ms-touch-action":"none"}),s.css(s.cursor,{"-ms-touch-action":"none"}),s.bind(s.win,"MSPointerDown",s.ontouchstart),s.bind(document,"MSPointerUp",s.ontouchend),s.bind(document,"MSPointerMove",s.ontouchmove),s.bind(s.cursor,"MSGestureHold",function(a){a.preventDefault()}),s.bind(s.cursor,"contextmenu",function(a){a.preventDefault()})),this.istouchcapable&&(s.bind(s.win,"touchstart",s.ontouchstart),s.bind(document,"touchend",s.ontouchend),s.bind(document,"touchcancel",s.ontouchend),s.bind(document,"touchmove",s.ontouchmove)),s.bind(s.cursor,"mousedown",s.onmousedown),s.bind(s.cursor,"mouseup",s.onmouseup),s.railh&&(s.bind(s.cursorh,"mousedown",function(a){s.onmousedown(a,!0)}),s.bind(s.cursorh,"mouseup",function(a){return s.rail.drag&&2==s.rail.drag.pt?void 0:(s.rail.drag=!1,s.hasmoving=!1,s.hideCursor(),w.hasmousecapture&&document.releaseCapture(),s.cancelEvent(a))})),(s.opt.cursordragontouch||!w.cantouch&&!s.opt.touchbehavior)&&(s.rail.css({cursor:"default"}),s.railh&&s.railh.css({cursor:"default"}),s.jqbind(s.rail,"mouseenter",function(){s.canshowonmouseevent&&s.showCursor(),s.rail.active=!0}),s.jqbind(s.rail,"mouseleave",function(){s.rail.active=!1,s.rail.drag||s.hideCursor()}),s.opt.sensitiverail&&(s.bind(s.rail,"click",function(a){s.doRailClick(a,!1,!1)}),s.bind(s.rail,"dblclick",function(a){s.doRailClick(a,!0,!1)}),s.bind(s.cursor,"click",function(a){s.cancelEvent(a)}),s.bind(s.cursor,"dblclick",function(a){s.cancelEvent(a)})),s.railh&&(s.jqbind(s.railh,"mouseenter",function(){s.canshowonmouseevent&&s.showCursor(),s.rail.active=!0}),s.jqbind(s.railh,"mouseleave",function(){s.rail.active=!1,s.rail.drag||s.hideCursor()}),s.opt.sensitiverail&&(s.bind(s.railh,"click",function(a){s.doRailClick(a,!1,!0)}),s.bind(s.railh,"dblclick",function(a){s.doRailClick(a,!0,!0)}),s.bind(s.cursorh,"click",function(a){s.cancelEvent(a)}),s.bind(s.cursorh,"dblclick",function(a){s.cancelEvent(a)})))),w.cantouch||s.opt.touchbehavior?(s.bind(w.hasmousecapture?s.win:document,"mouseup",s.ontouchend),s.bind(document,"mousemove",s.ontouchmove),s.onclick&&s.bind(document,"click",s.onclick),s.opt.cursordragontouch&&(s.bind(s.cursor,"mousedown",s.onmousedown),s.bind(s.cursor,"mousemove",s.onmousemove),s.cursorh&&s.bind(s.cursorh,"mousedown",s.onmousedown),s.cursorh&&s.bind(s.cursorh,"mousemove",s.onmousemove))):(s.bind(w.hasmousecapture?s.win:document,"mouseup",s.onmouseup),s.bind(document,"mousemove",s.onmousemove),s.onclick&&s.bind(document,"click",s.onclick),!s.ispage&&s.opt.enablescrollonselection&&(s.bind(s.win[0],"mousedown",s.onselectionstart),s.bind(document,"mouseup",s.onselectionend),s.bind(s.cursor,"mouseup",s.onselectionend),s.cursorh&&s.bind(s.cursorh,"mouseup",s.onselectionend),s.bind(document,"mousemove",s.onselectiondrag)),s.zoom&&(s.jqbind(s.zoom,"mouseenter",function(){s.canshowonmouseevent&&s.showCursor(),s.rail.active=!0}),s.jqbind(s.zoom,"mouseleave",function(){s.rail.active=!1,s.rail.drag||s.hideCursor()}))),s.opt.enablemousewheel&&(s.isiframe||s.bind(w.isie&&s.ispage?document:s.win,"mousewheel",s.onmousewheel),s.bind(s.rail,"mousewheel",s.onmousewheel),s.railh&&s.bind(s.railh,"mousewheel",s.onmousewheelhr)),s.ispage||w.cantouch||/HTML|BODY/.test(s.win[0].nodeName)||(s.win.attr("tabindex")||s.win.attr({tabindex:g++}),s.jqbind(s.win,"focus",function(a){e=s.getTarget(a).id||!0,s.hasfocus=!0,s.canshowonmouseevent&&s.noticeCursor()}),s.jqbind(s.win,"blur",function(a){e=!1,s.hasfocus=!1}),s.jqbind(s.win,"mouseenter",function(a){f=s.getTarget(a).id||!0,s.hasmousefocus=!0,s.canshowonmouseevent&&s.noticeCursor()}),s.jqbind(s.win,"mouseleave",function(){f=!1,s.hasmousefocus=!1}))}if(s.onkeypress=function(a){if(s.locked&&0==s.page.maxh)return!0;
  a=a?a:window.e;var b=s.getTarget(a);if(b&&/INPUT|TEXTAREA|SELECT|OPTION/.test(b.nodeName)){var c=b.getAttribute("type")||b.type||!1;if(!c||!/submit|button|cancel/i.tp)return!0}if(s.hasfocus||s.hasmousefocus&&!e||s.ispage&&!e&&!f){var d=a.keyCode;if(s.locked&&27!=d)return s.cancelEvent(a);var g=a.ctrlKey||!1,h=a.shiftKey||!1,i=!1;switch(d){case 38:case 63233:s.doScrollBy(72),i=!0;break;case 40:case 63235:s.doScrollBy(-72),i=!0;break;case 37:case 63232:s.railh&&(g?s.doScrollLeft(0):s.doScrollLeftBy(72),i=!0);break;case 39:case 63234:s.railh&&(g?s.doScrollLeft(s.page.maxw):s.doScrollLeftBy(-72),i=!0);break;case 33:case 63276:s.doScrollBy(s.view.h),i=!0;break;case 34:case 63277:s.doScrollBy(-s.view.h),i=!0;break;case 36:case 63273:s.railh&&g?s.doScrollPos(0,0):s.doScrollTo(0),i=!0;break;case 35:case 63275:s.railh&&g?s.doScrollPos(s.page.maxw,s.page.maxh):s.doScrollTo(s.page.maxh),i=!0;break;case 32:s.opt.spacebarenabled&&(h?s.doScrollBy(s.view.h):s.doScrollBy(-s.view.h),i=!0);break;case 27:s.zoomactive&&(s.doZoom(),i=!0)}if(i)return s.cancelEvent(a)}},s.opt.enablekeyboard&&s.bind(document,w.isopera&&!w.isopera12?"keypress":"keydown",s.onkeypress),s.bind(window,"resize",s.lazyResize),s.bind(window,"orientationchange",s.lazyResize),s.bind(window,"load",s.lazyResize),w.ischrome&&!s.ispage&&!s.haswrapper){var B=s.win.attr("style"),C=parseFloat(s.win.css("width"))+1;s.win.css("width",C),s.synched("chromefix",function(){s.win.attr("style",B)})}s.onAttributeChange=function(a){s.lazyResize(250)},s.ispage||s.haswrapper||(q!==!1?(s.observer=new q(function(a){a.forEach(s.onAttributeChange)}),s.observer.observe(s.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),s.observerremover=new q(function(a){a.forEach(function(a){if(a.removedNodes.length>0)for(var b in a.removedNodes)if(a.removedNodes[b]==s.win[0])return s.remove()})}),s.observerremover.observe(s.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(s.bind(s.win,w.isie&&!w.isie9?"propertychange":"DOMAttrModified",s.onAttributeChange),w.isie9&&s.win[0].attachEvent("onpropertychange",s.onAttributeChange),s.bind(s.win,"DOMNodeRemoved",function(a){a.target==s.win[0]&&s.remove()}))),!s.ispage&&s.opt.boxzoom&&s.bind(window,"resize",s.resizeZoom),s.istextarea&&s.bind(s.win,"mouseup",s.lazyResize),s.checkrtlmode=!0,s.lazyResize(30)}"IFRAME"==this.doc[0].nodeName&&(this.doc[0].readyState&&"complete"==this.doc[0].readyState&&setTimeout(function(){b.call(s.doc[0],!1)},500),s.bind(this.doc,"load",b))},this.showCursor=function(a,b){s.cursortimeout&&(clearTimeout(s.cursortimeout),s.cursortimeout=0),s.rail&&(s.autohidedom&&(s.autohidedom.stop().css({opacity:s.opt.cursoropacitymax}),s.cursoractive=!0),s.rail.drag&&1==s.rail.drag.pt||("undefined"!=typeof a&&a!==!1&&(s.scroll.y=Math.round(1*a/s.scrollratio.y)),"undefined"!=typeof b&&(s.scroll.x=Math.round(1*b/s.scrollratio.x))),s.cursor.css({height:s.cursorheight,top:s.scroll.y}),s.cursorh&&(!s.rail.align&&s.rail.visibility?s.cursorh.css({width:s.cursorwidth,left:s.scroll.x+s.rail.width}):s.cursorh.css({width:s.cursorwidth,left:s.scroll.x}),s.cursoractive=!0),s.zoom&&s.zoom.stop().css({opacity:s.opt.cursoropacitymax}))},this.hideCursor=function(a){s.cursortimeout||s.rail&&s.autohidedom&&(s.cursortimeout=setTimeout(function(){s.rail.active&&s.showonmouseevent||(s.autohidedom.stop().animate({opacity:s.opt.cursoropacitymin}),s.zoom&&s.zoom.stop().animate({opacity:s.opt.cursoropacitymin}),s.cursoractive=!1),s.cursortimeout=0},a||s.opt.hidecursordelay))},this.noticeCursor=function(a,b,c){s.showCursor(b,c),s.rail.active||s.hideCursor(a)},this.getContentSize=s.ispage?function(){return{w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}}:s.haswrapper?function(){return{w:s.doc.outerWidth()+parseInt(s.win.css("paddingLeft"))+parseInt(s.win.css("paddingRight")),h:s.doc.outerHeight()+parseInt(s.win.css("paddingTop"))+parseInt(s.win.css("paddingBottom"))}}:function(){return{w:s.docscroll[0].scrollWidth,h:s.docscroll[0].scrollHeight}},this.onResize=function(a,b){if(!s.win)return!1;if(!s.haswrapper&&!s.ispage){if("none"==s.win.css("display"))return s.visibility&&s.hideRail().hideRailHr(),!1;s.hidden||s.visibility||s.showRail().showRailHr()}var c=s.page.maxh,d=s.page.maxw,e={h:s.view.h,w:s.view.w};if(s.view={w:s.ispage?s.win.width():parseInt(s.win[0].clientWidth),h:s.ispage?s.win.height():parseInt(s.win[0].clientHeight)},s.page=b?b:s.getContentSize(),s.page.maxh=Math.max(0,s.page.h-s.view.h),s.page.maxw=Math.max(0,s.page.w-s.view.w),s.page.maxh==c&&s.page.maxw==d&&s.view.w==e.w){if(s.ispage)return s;var f=s.win.offset();if(s.lastposition){var g=s.lastposition;if(g.top==f.top&&g.left==f.left)return s}s.lastposition=f}if(0==s.page.maxh?(s.hideRail(),s.scrollvaluemax=0,s.scroll.y=0,s.scrollratio.y=0,s.cursorheight=0,s.setScrollTop(0),s.rail.scrollable=!1):s.rail.scrollable=!0,0==s.page.maxw?(s.hideRailHr(),s.scrollvaluemaxw=0,s.scroll.x=0,s.scrollratio.x=0,s.cursorwidth=0,s.setScrollLeft(0),s.railh.scrollable=!1):s.railh.scrollable=!0,s.locked=0==s.page.maxh&&0==s.page.maxw,s.locked)return s.ispage||s.updateScrollBar(s.view),!1;s.hidden||s.visibility?s.hidden||s.railh.visibility||s.showRailHr():s.showRail().showRailHr(),s.istextarea&&s.win.css("resize")&&"none"!=s.win.css("resize")&&(s.view.h-=20),s.cursorheight=Math.min(s.view.h,Math.round(s.view.h*(s.view.h/s.page.h))),s.cursorheight=s.opt.cursorfixedheight?s.opt.cursorfixedheight:Math.max(s.opt.cursorminheight,s.cursorheight),s.cursorwidth=Math.min(s.view.w,Math.round(s.view.w*(s.view.w/s.page.w))),s.cursorwidth=s.opt.cursorfixedheight?s.opt.cursorfixedheight:Math.max(s.opt.cursorminheight,s.cursorwidth),s.scrollvaluemax=s.view.h-s.cursorheight-s.cursor.hborder,s.railh&&(s.railh.width=s.page.maxh>0?s.view.w-s.rail.width:s.view.w,s.scrollvaluemaxw=s.railh.width-s.cursorwidth-s.cursorh.wborder),s.checkrtlmode&&s.railh&&(s.checkrtlmode=!1,s.opt.rtlmode&&0==s.scroll.x&&s.setScrollLeft(s.page.maxw)),s.ispage||s.updateScrollBar(s.view),s.scrollratio={x:s.page.maxw/s.scrollvaluemaxw,y:s.page.maxh/s.scrollvaluemax};var h=s.getScrollTop();return h>s.page.maxh?s.doScrollTop(s.page.maxh):(s.scroll.y=Math.round(s.getScrollTop()*(1/s.scrollratio.y)),s.scroll.x=Math.round(s.getScrollLeft()*(1/s.scrollratio.x)),s.cursoractive&&s.noticeCursor()),s.scroll.y&&0==s.getScrollTop()&&s.doScrollTo(Math.floor(s.scroll.y*s.scrollratio.y)),s},this.resize=s.onResize,this.lazyResize=function(a){return a=isNaN(a)?30:a,s.delayed("resize",s.resize,a),s},this._bind=function(a,b,c,d){s.events.push({e:a,n:b,f:c,b:d,q:!1}),a.addEventListener?a.addEventListener(b,c,d||!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c},this.jqbind=function(a,b,c){s.events.push({e:a,n:b,f:c,q:!0}),j(a).bind(b,c)},this.bind=function(a,b,c,d){var e="jquery"in a?a[0]:a;if("mousewheel"==b)if("onwheel"in s.win)s._bind(e,"wheel",c,d||!1);else{var f="undefined"!=typeof document.onmousewheel?"mousewheel":"DOMMouseScroll";o(e,f,c,d||!1),"DOMMouseScroll"==f&&o(e,"MozMousePixelScroll",c,d||!1)}else if(e.addEventListener){if(w.cantouch&&/mouseup|mousedown|mousemove/.test(b)){var g="mousedown"==b?"touchstart":"mouseup"==b?"touchend":"touchmove";s._bind(e,g,function(a){if(a.touches){if(a.touches.length<2){var b=a.touches.length?a.touches[0]:a;b.original=a,c.call(this,b)}}else if(a.changedTouches){var b=a.changedTouches[0];b.original=a,c.call(this,b)}},d||!1)}s._bind(e,b,c,d||!1),w.cantouch&&"mouseup"==b&&s._bind(e,"touchcancel",c,d||!1)}else s._bind(e,b,function(a){return a=a||window.event||!1,a&&a.srcElement&&(a.target=a.srcElement),"pageY"in a||(a.pageX=a.clientX+document.documentElement.scrollLeft,a.pageY=a.clientY+document.documentElement.scrollTop),c.call(e,a)===!1||d===!1?s.cancelEvent(a):!0})},this._unbind=function(a,b,c,d){a.removeEventListener?a.removeEventListener(b,c,d):a.detachEvent?a.detachEvent("on"+b,c):a["on"+b]=!1},this.unbindAll=function(){for(var a=0;a<s.events.length;a++){var b=s.events[a];b.q?b.e.unbind(b.n,b.f):s._unbind(b.e,b.n,b.f,b.b)}},this.cancelEvent=function(a){var a=a.original?a.original:a?a:window.event||!1;return a?(a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation(),a.preventManipulation&&a.preventManipulation(),a.cancelBubble=!0,a.cancel=!0,a.returnValue=!1,!1):!1},this.stopPropagation=function(a){var a=a.original?a.original:a?a:window.event||!1;return a?a.stopPropagation?a.stopPropagation():(a.cancelBubble&&(a.cancelBubble=!0),!1):!1},this.showRail=function(){return 0==s.page.maxh||!s.ispage&&"none"==s.win.css("display")||(s.visibility=!0,s.rail.visibility=!0,s.rail.css("display","block")),s},this.showRailHr=function(){return s.railh?(0==s.page.maxw||!s.ispage&&"none"==s.win.css("display")||(s.railh.visibility=!0,s.railh.css("display","block")),s):s},this.hideRail=function(){return s.visibility=!1,s.rail.visibility=!1,s.rail.css("display","none"),s},this.hideRailHr=function(){return s.railh?(s.railh.visibility=!1,s.railh.css("display","none"),s):s},this.show=function(){return s.hidden=!1,s.locked=!1,s.showRail().showRailHr()},this.hide=function(){return s.hidden=!0,s.locked=!0,s.hideRail().hideRailHr()},this.toggle=function(){return s.hidden?s.show():s.hide()},this.remove=function(){s.stop(),s.cursortimeout&&clearTimeout(s.cursortimeout),s.doZoomOut(),s.unbindAll(),w.isie9&&s.win[0].detachEvent("onpropertychange",s.onAttributeChange),s.observer!==!1&&s.observer.disconnect(),s.observerremover!==!1&&s.observerremover.disconnect(),s.events=null,s.cursor&&s.cursor.remove(),s.cursorh&&s.cursorh.remove(),s.rail&&s.rail.remove(),s.railh&&s.railh.remove(),s.zoom&&s.zoom.remove();for(var a=0;a<s.saved.css.length;a++){var b=s.saved.css[a];b[0].css(b[1],"undefined"==typeof b[2]?"":b[2])}s.saved=!1,s.me.data("__nicescroll","");var c=j.nicescroll;c.each(function(a){if(this&&this.id===s.id){delete c[a];for(var b=++a;b<c.length;b++,a++)c[a]=c[b];c.length--,c.length&&delete c[c.length]}});for(var d in s)s[d]=null,delete s[d];s=null},this.scrollstart=function(a){return this.onscrollstart=a,s},this.scrollend=function(a){return this.onscrollend=a,s},this.scrollcancel=function(a){return this.onscrollcancel=a,s},this.zoomin=function(a){return this.onzoomin=a,s},this.zoomout=function(a){return this.onzoomout=a,s},this.isScrollable=function(a){var b=a.target?a.target:a;if("OPTION"==b.nodeName)return!0;for(;b&&1==b.nodeType&&!/BODY|HTML/.test(b.nodeName);){var c=j(b),d=c.css("overflowY")||c.css("overflowX")||c.css("overflow")||"";if(/scroll|auto/.test(d))return b.clientHeight!=b.scrollHeight;b=b.parentNode?b.parentNode:!1}return!1},this.getViewport=function(a){for(var b=a&&a.parentNode?a.parentNode:!1;b&&1==b.nodeType&&!/BODY|HTML/.test(b.nodeName);){var c=j(b),d=c.css("overflowY")||c.css("overflowX")||c.css("overflow")||"";if(/scroll|auto/.test(d)&&b.clientHeight!=b.scrollHeight)return c;if(c.getNiceScroll().length>0)return c;b=b.parentNode?b.parentNode:!1}return!1},this.onmousewheel=function(a){if(s.locked)return s.debounced("checkunlock",s.resize,250),!0;if(s.rail.drag)return s.cancelEvent(a);if("auto"==s.opt.oneaxismousemode&&0!=a.deltaX&&(s.opt.oneaxismousemode=!1),s.opt.oneaxismousemode&&0==a.deltaX&&!s.rail.scrollable)return s.railh&&s.railh.scrollable?s.onmousewheelhr(a):!0;var b=+new Date,c=!1;if(s.opt.preservenativescrolling&&s.checkarea+600<b&&(s.nativescrollingarea=s.isScrollable(a),c=!0),s.checkarea=b,s.nativescrollingarea)return!0;var d=p(a,!1,c);return d&&(s.checkarea=0),d},this.onmousewheelhr=function(a){if(s.locked||!s.railh.scrollable)return!0;if(s.rail.drag)return s.cancelEvent(a);var b=+new Date,c=!1;return s.opt.preservenativescrolling&&s.checkarea+600<b&&(s.nativescrollingarea=s.isScrollable(a),c=!0),s.checkarea=b,s.nativescrollingarea?!0:s.locked?s.cancelEvent(a):p(a,!0,c)},this.stop=function(){return s.cancelScroll(),s.scrollmon&&s.scrollmon.stop(),s.cursorfreezed=!1,s.scroll.y=Math.round(s.getScrollTop()*(1/s.scrollratio.y)),s.noticeCursor(),s},this.getTransitionSpeed=function(a){var b=Math.round(10*s.opt.scrollspeed),c=Math.min(b,Math.round(a/20*s.opt.scrollspeed));return c>20?c:0},s.opt.smoothscroll?s.ishwscroll&&w.hastransition&&s.opt.usetransition?(this.prepareTransition=function(a,b){var c=b?a>20?a:0:s.getTransitionSpeed(a),d=c?w.prefixstyle+"transform "+c+"ms ease-out":"";return s.lasttransitionstyle&&s.lasttransitionstyle==d||(s.lasttransitionstyle=d,s.doc.css(w.transitionstyle,d)),c},this.doScrollLeft=function(a,b){var c=s.scrollrunning?s.newscrolly:s.getScrollTop();s.doScrollPos(a,c,b)},this.doScrollTop=function(a,b){var c=s.scrollrunning?s.newscrollx:s.getScrollLeft();s.doScrollPos(c,a,b)},this.doScrollPos=function(a,b,c){var d=s.getScrollTop(),e=s.getScrollLeft();return((s.newscrolly-d)*(b-d)<0||(s.newscrollx-e)*(a-e)<0)&&s.cancelScroll(),0==s.opt.bouncescroll&&(0>b?b=0:b>s.page.maxh&&(b=s.page.maxh),0>a?a=0:a>s.page.maxw&&(a=s.page.maxw)),s.scrollrunning&&a==s.newscrollx&&b==s.newscrolly?!1:(s.newscrolly=b,s.newscrollx=a,s.newscrollspeed=c||!1,s.timer?!1:void(s.timer=setTimeout(function(){var c=s.getScrollTop(),d=s.getScrollLeft(),e={};e.x=a-d,e.y=b-c,e.px=d,e.py=c;var f=Math.round(Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))),g=s.newscrollspeed&&s.newscrollspeed>1?s.newscrollspeed:s.getTransitionSpeed(f);if(s.newscrollspeed&&s.newscrollspeed<=1&&(g*=s.newscrollspeed),s.prepareTransition(g,!0),s.timerscroll&&s.timerscroll.tm&&clearInterval(s.timerscroll.tm),g>0){if(!s.scrollrunning&&s.onscrollstart){var h={type:"scrollstart",current:{x:d,y:c},request:{x:a,y:b},end:{x:s.newscrollx,y:s.newscrolly},speed:g};s.onscrollstart.call(s,h)}w.transitionend?s.scrollendtrapped||(s.scrollendtrapped=!0,s.bind(s.doc,w.transitionend,s.onScrollEnd,!1)):(s.scrollendtrapped&&clearTimeout(s.scrollendtrapped),s.scrollendtrapped=setTimeout(s.onScrollEnd,g));var i=c,j=d;s.timerscroll={bz:new BezierClass(i,s.newscrolly,g,0,0,.58,1),bh:new BezierClass(j,s.newscrollx,g,0,0,.58,1)},s.cursorfreezed||(s.timerscroll.tm=setInterval(function(){s.showCursor(s.getScrollTop(),s.getScrollLeft())},60))}s.synched("doScroll-set",function(){s.timer=0,s.scrollendtrapped&&(s.scrollrunning=!0),s.setScrollTop(s.newscrolly),s.setScrollLeft(s.newscrollx),s.scrollendtrapped||s.onScrollEnd()})},50)))},this.cancelScroll=function(){if(!s.scrollendtrapped)return!0;var a=s.getScrollTop(),b=s.getScrollLeft();return s.scrollrunning=!1,w.transitionend||clearTimeout(w.transitionend),s.scrollendtrapped=!1,s._unbind(s.doc,w.transitionend,s.onScrollEnd),s.prepareTransition(0),s.setScrollTop(a),s.railh&&s.setScrollLeft(b),s.timerscroll&&s.timerscroll.tm&&clearInterval(s.timerscroll.tm),s.timerscroll=!1,s.cursorfreezed=!1,s.showCursor(a,b),s},this.onScrollEnd=function(){s.scrollendtrapped&&s._unbind(s.doc,w.transitionend,s.onScrollEnd),s.scrollendtrapped=!1,s.prepareTransition(0),s.timerscroll&&s.timerscroll.tm&&clearInterval(s.timerscroll.tm),s.timerscroll=!1;var a=s.getScrollTop(),b=s.getScrollLeft();if(s.setScrollTop(a),s.railh&&s.setScrollLeft(b),s.noticeCursor(!1,a,b),s.cursorfreezed=!1,0>a?a=0:a>s.page.maxh&&(a=s.page.maxh),0>b?b=0:b>s.page.maxw&&(b=s.page.maxw),a!=s.newscrolly||b!=s.newscrollx)return s.doScrollPos(b,a,s.opt.snapbackspeed);if(s.onscrollend&&s.scrollrunning){var c={type:"scrollend",current:{x:b,y:a},end:{x:s.newscrollx,y:s.newscrolly}};s.onscrollend.call(s,c)}s.scrollrunning=!1}):(this.doScrollLeft=function(a,b){var c=s.scrollrunning?s.newscrolly:s.getScrollTop();s.doScrollPos(a,c,b)},this.doScrollTop=function(a,b){var c=s.scrollrunning?s.newscrollx:s.getScrollLeft();s.doScrollPos(c,a,b)},this.doScrollPos=function(a,b,c){function d(){if(s.cancelAnimationFrame)return!0;if(s.scrollrunning=!0,k=1-k)return s.timer=m(d)||1;var a=0,b=sy=s.getScrollTop();if(s.dst.ay){b=s.bzscroll?s.dst.py+s.bzscroll.getNow()*s.dst.ay:s.newscrolly;var c=b-sy;(0>c&&b<s.newscrolly||c>0&&b>s.newscrolly)&&(b=s.newscrolly),s.setScrollTop(b),b==s.newscrolly&&(a=1)}else a=1;var e=sx=s.getScrollLeft();if(s.dst.ax){e=s.bzscroll?s.dst.px+s.bzscroll.getNow()*s.dst.ax:s.newscrollx;var c=e-sx;(0>c&&e<s.newscrollx||c>0&&e>s.newscrollx)&&(e=s.newscrollx),s.setScrollLeft(e),e==s.newscrollx&&(a+=1)}else a+=1;if(2==a){if(s.timer=0,s.cursorfreezed=!1,s.bzscroll=!1,s.scrollrunning=!1,0>b?b=0:b>s.page.maxh&&(b=s.page.maxh),0>e?e=0:e>s.page.maxw&&(e=s.page.maxw),e!=s.newscrollx||b!=s.newscrolly)s.doScrollPos(e,b);else if(s.onscrollend){var f={type:"scrollend",current:{x:sx,y:sy},end:{x:s.newscrollx,y:s.newscrolly}};s.onscrollend.call(s,f)}}else s.timer=m(d)||1}var b="undefined"==typeof b||b===!1?s.getScrollTop(!0):b;if(s.timer&&s.newscrolly==b&&s.newscrollx==a)return!0;s.timer&&n(s.timer),s.timer=0;var e=s.getScrollTop(),f=s.getScrollLeft();((s.newscrolly-e)*(b-e)<0||(s.newscrollx-f)*(a-f)<0)&&s.cancelScroll(),s.newscrolly=b,s.newscrollx=a,s.bouncescroll&&s.rail.visibility||(s.newscrolly<0?s.newscrolly=0:s.newscrolly>s.page.maxh&&(s.newscrolly=s.page.maxh)),s.bouncescroll&&s.railh.visibility||(s.newscrollx<0?s.newscrollx=0:s.newscrollx>s.page.maxw&&(s.newscrollx=s.page.maxw)),s.dst={},s.dst.x=a-f,s.dst.y=b-e,s.dst.px=f,s.dst.py=e;var g=Math.round(Math.sqrt(Math.pow(s.dst.x,2)+Math.pow(s.dst.y,2)));s.dst.ax=s.dst.x/g,s.dst.ay=s.dst.y/g;var h=0,i=g;0==s.dst.x?(h=e,i=b,s.dst.ay=1,s.dst.py=0):0==s.dst.y&&(h=f,i=a,s.dst.ax=1,s.dst.px=0);var j=s.getTransitionSpeed(g);if(c&&1>=c&&(j*=c),j>0?s.bzscroll=s.bzscroll?s.bzscroll.update(i,j):new BezierClass(h,i,j,0,1,0,1):s.bzscroll=!1,!s.timer){(e==s.page.maxh&&b>=s.page.maxh||f==s.page.maxw&&a>=s.page.maxw)&&s.checkContentSize();var k=1;if(s.cancelAnimationFrame=!1,s.timer=1,s.onscrollstart&&!s.scrollrunning){var l={type:"scrollstart",current:{x:f,y:e},request:{x:a,y:b},end:{x:s.newscrollx,y:s.newscrolly},speed:j};s.onscrollstart.call(s,l)}d(),(e==s.page.maxh&&b>=e||f==s.page.maxw&&a>=f)&&s.checkContentSize(),s.noticeCursor()}},this.cancelScroll=function(){return s.timer&&n(s.timer),s.timer=0,s.bzscroll=!1,s.scrollrunning=!1,s}):(this.doScrollLeft=function(a,b){var c=s.getScrollTop();s.doScrollPos(a,c,b)},this.doScrollTop=function(a,b){var c=s.getScrollLeft();s.doScrollPos(c,a,b)},this.doScrollPos=function(a,b,c){var d=a>s.page.maxw?s.page.maxw:a;0>d&&(d=0);var e=b>s.page.maxh?s.page.maxh:b;0>e&&(e=0),s.synched("scroll",function(){s.setScrollTop(e),s.setScrollLeft(d)})},this.cancelScroll=function(){}),this.doScrollBy=function(a,b){var c=0;if(b)c=Math.floor((s.scroll.y-a)*s.scrollratio.y);else{var d=s.timer?s.newscrolly:s.getScrollTop(!0);c=d-a}if(s.bouncescroll){var e=Math.round(s.view.h/2);-e>c?c=-e:c>s.page.maxh+e&&(c=s.page.maxh+e)}return s.cursorfreezed=!1,py=s.getScrollTop(!0),0>c&&py<=0?s.noticeCursor():c>s.page.maxh&&py>=s.page.maxh?(s.checkContentSize(),s.noticeCursor()):void s.doScrollTop(c)},this.doScrollLeftBy=function(a,b){var c=0;if(b)c=Math.floor((s.scroll.x-a)*s.scrollratio.x);else{var d=s.timer?s.newscrollx:s.getScrollLeft(!0);c=d-a}if(s.bouncescroll){var e=Math.round(s.view.w/2);-e>c?c=-e:c>s.page.maxw+e&&(c=s.page.maxw+e)}return s.cursorfreezed=!1,px=s.getScrollLeft(!0),0>c&&px<=0?s.noticeCursor():c>s.page.maxw&&px>=s.page.maxw?s.noticeCursor():void s.doScrollLeft(c)},this.doScrollTo=function(a,b){var c=b?Math.round(a*s.scrollratio.y):a;0>c?c=0:c>s.page.maxh&&(c=s.page.maxh),s.cursorfreezed=!1,s.doScrollTop(a)},this.checkContentSize=function(){var a=s.getContentSize();(a.h!=s.page.h||a.w!=s.page.w)&&s.resize(!1,a)},s.onscroll=function(a){s.rail.drag||s.cursorfreezed||s.synched("scroll",function(){s.scroll.y=Math.round(s.getScrollTop()*(1/s.scrollratio.y)),s.railh&&(s.scroll.x=Math.round(s.getScrollLeft()*(1/s.scrollratio.x))),s.noticeCursor()})},s.bind(s.docscroll,"scroll",s.onscroll),this.doZoomIn=function(a){if(!s.zoomactive){s.zoomactive=!0,s.zoomrestore={style:{}};var b=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],c=s.win[0].style;for(var d in b){var e=b[d];s.zoomrestore.style[e]="undefined"!=typeof c[e]?c[e]:""}s.zoomrestore.style.width=s.win.css("width"),s.zoomrestore.style.height=s.win.css("height"),s.zoomrestore.padding={w:s.win.outerWidth()-s.win.width(),h:s.win.outerHeight()-s.win.height()},w.isios4&&(s.zoomrestore.scrollTop=j(window).scrollTop(),j(window).scrollTop(0)),s.win.css({position:w.isios4?"absolute":"fixed",top:0,left:0,"z-index":i+100,margin:"0px"});var f=s.win.css("backgroundColor");return(""==f||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(f))&&s.win.css("backgroundColor","#fff"),s.rail.css({"z-index":i+101}),s.zoom.css({"z-index":i+102}),s.zoom.css("backgroundPosition","0px -18px"),s.resizeZoom(),s.onzoomin&&s.onzoomin.call(s),s.cancelEvent(a)}},this.doZoomOut=function(a){return s.zoomactive?(s.zoomactive=!1,s.win.css("margin",""),s.win.css(s.zoomrestore.style),w.isios4&&j(window).scrollTop(s.zoomrestore.scrollTop),s.rail.css({"z-index":s.zindex}),s.zoom.css({"z-index":s.zindex}),s.zoomrestore=!1,s.zoom.css("backgroundPosition","0px 0px"),s.onResize(),s.onzoomout&&s.onzoomout.call(s),s.cancelEvent(a)):void 0},this.doZoom=function(a){return s.zoomactive?s.doZoomOut(a):s.doZoomIn(a)},this.resizeZoom=function(){if(s.zoomactive){var a=s.getScrollTop();s.win.css({width:j(window).width()-s.zoomrestore.padding.w+"px",height:j(window).height()-s.zoomrestore.padding.h+"px"}),s.onResize(),s.setScrollTop(Math.min(s.page.maxh,a))}},this.init(),j.nicescroll.push(this)},v=function(a){var b=this;this.nc=a,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.time=function(){return+new Date},this.reset=function(a,c){b.stop();var d=b.time();b.steptime=0,b.lasttime=d,b.speedx=0,b.speedy=0,b.lastx=a,b.lasty=c,b.lastscrollx=-1,b.lastscrolly=-1},this.update=function(a,c){var d=b.time();b.steptime=d-b.lasttime,b.lasttime=d;var e=c-b.lasty,f=a-b.lastx,g=b.nc.getScrollTop(),h=b.nc.getScrollLeft(),i=g+e,j=h+f;b.snapx=0>j||j>b.nc.page.maxw,b.snapy=0>i||i>b.nc.page.maxh,b.speedx=f,b.speedy=e,b.lastx=a,b.lasty=c},this.stop=function(){b.nc.unsynched("domomentum2d"),b.timer&&clearTimeout(b.timer),b.timer=0,b.lastscrollx=-1,b.lastscrolly=-1},this.doSnapy=function(a,c){var d=!1;0>c?(c=0,d=!0):c>b.nc.page.maxh&&(c=b.nc.page.maxh,d=!0),0>a?(a=0,d=!0):a>b.nc.page.maxw&&(a=b.nc.page.maxw,d=!0),d&&b.nc.doScrollPos(a,c,b.nc.opt.snapbackspeed)},this.doMomentum=function(a){var c=b.time(),d=a?c+a:b.lasttime,e=b.nc.getScrollLeft(),f=b.nc.getScrollTop(),g=b.nc.page.maxh,h=b.nc.page.maxw;b.speedx=h>0?Math.min(60,b.speedx):0,b.speedy=g>0?Math.min(60,b.speedy):0;var i=d&&60>=c-d;(0>f||f>g||0>e||e>h)&&(i=!1);var j=b.speedy&&i?b.speedy:!1,k=b.speedx&&i?b.speedx:!1;if(j||k){var l=Math.max(16,b.steptime);if(l>50){var m=l/50;b.speedx*=m,b.speedy*=m,l=50}b.demulxy=0,b.lastscrollx=b.nc.getScrollLeft(),b.chkx=b.lastscrollx,b.lastscrolly=b.nc.getScrollTop(),b.chky=b.lastscrolly;var n=b.lastscrollx,o=b.lastscrolly,p=function(){var a=b.time()-c>600?.04:.02;b.speedx&&(n=Math.floor(b.lastscrollx-b.speedx*(1-b.demulxy)),b.lastscrollx=n,(0>n||n>h)&&(a=.1)),b.speedy&&(o=Math.floor(b.lastscrolly-b.speedy*(1-b.demulxy)),b.lastscrolly=o,(0>o||o>g)&&(a=.1)),b.demulxy=Math.min(1,b.demulxy+a),b.nc.synched("domomentum2d",function(){if(b.speedx){var a=b.nc.getScrollLeft();a!=b.chkx&&b.stop(),b.chkx=n,b.nc.setScrollLeft(n)}if(b.speedy){var c=b.nc.getScrollTop();c!=b.chky&&b.stop(),b.chky=o,b.nc.setScrollTop(o)}b.timer||(b.nc.hideCursor(),b.doSnapy(n,o))}),b.demulxy<1?b.timer=setTimeout(p,l):(b.stop(),b.nc.hideCursor(),b.doSnapy(n,o))};p()}else b.doSnapy(b.nc.getScrollLeft(),b.nc.getScrollTop())}},w=b.fn.scrollTop;b.cssHooks.pageYOffset={get:function(a,b,c){var d=j.data(a,"__nicescroll")||!1;return d&&d.ishwscroll?d.getScrollTop():w.call(a)},set:function(a,b){var c=j.data(a,"__nicescroll")||!1;return c&&c.ishwscroll?c.setScrollTop(parseInt(b)):w.call(a,b),this}},b.fn.scrollTop=function(a){if("undefined"==typeof a){var b=this[0]?j.data(this[0],"__nicescroll")||!1:!1;return b&&b.ishwscroll?b.getScrollTop():w.call(this)}return this.each(function(){var b=j.data(this,"__nicescroll")||!1;b&&b.ishwscroll?b.setScrollTop(parseInt(a)):w.call(j(this),a)})};var x=b.fn.scrollLeft;j.cssHooks.pageXOffset={get:function(a,b,c){var d=j.data(a,"__nicescroll")||!1;return d&&d.ishwscroll?d.getScrollLeft():x.call(a)},set:function(a,b){var c=j.data(a,"__nicescroll")||!1;return c&&c.ishwscroll?c.setScrollLeft(parseInt(b)):x.call(a,b),this}},b.fn.scrollLeft=function(a){if("undefined"==typeof a){var b=this[0]?j.data(this[0],"__nicescroll")||!1:!1;return b&&b.ishwscroll?b.getScrollLeft():x.call(this)}return this.each(function(){var b=j.data(this,"__nicescroll")||!1;b&&b.ishwscroll?b.setScrollLeft(parseInt(a)):x.call(j(this),a)})};var y=function(b){var c=this;if(this.length=0,this.name="nicescrollarray",this.each=function(a){for(var b=0,d=0;b<c.length;b++)a.call(c[b],d++);return c},this.push=function(a){c[c.length]=a,c.length++},this.eq=function(a){return c[a]},b)for(a=0;a<b.length;a++){var d=j.data(b[a],"__nicescroll")||!1;d&&(this[this.length]=d,this.length++)}return this};d(y.prototype,["show","hide","toggle","onResize","resize","remove","stop","doScrollPos"],function(a,b){a[b]=function(){var a=arguments;return this.each(function(){this[b].apply(this,a)})}}),b.fn.getNiceScroll=function(a){if("undefined"==typeof a)return new y(this);var b=this[a]&&j.data(this[a],"__nicescroll")||!1;return b},b.extend(b.expr[":"],{nicescroll:function(a){return j.data(a,"__nicescroll")?!0:!1}}),j.fn.niceScroll=function(a,b){"undefined"==typeof b&&("object"!=typeof a||"jquery"in a||(b=a,a=!1));var c=new y;"undefined"==typeof b&&(b={}),a&&(b.doc=j(a),b.win=j(this));var d=!("doc"in b);return d||"win"in b||(b.win=j(this)),this.each(function(){var a=j(this).data("__nicescroll")||!1;a||(b.doc=d?j(this):b.doc,a=new u(b,j(this)),j(this).data("__nicescroll",a)),c.push(a)}),1==c.length?c[0]:c},window.NiceScroll={getjQuery:function(){return b}},j.nicescroll||(j.nicescroll=new y,j.nicescroll.options=r)}(jQuery);