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