/** * jquery.nicescroll 3.5.4 * InuYaksa 2013 MIT http://areaaperta.com/nicescroll * */ (function(e){"function"===typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){var t=!1,n=!1,r=5e3,i=2e3,s=0,o=["ms","moz","webkit","o"],u=window.requestAnimationFrame||!1,a=window.cancelAnimationFrame||!1;if(!u)for(var f in o){var l=o[f];u||(u=window[l+"RequestAnimationFrame"]);a||(a=window[l+"CancelAnimationFrame"]||window[l+"CancelRequestAnimationFrame"])}var c=window.MutationObserver||window.WebKitMutationObserver||!1,h={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 e=document.getElementsByTagName("script"),e=e[e.length-1].src.split("?")[0];return 0i){if(y.getScrollTop()>=y.page.maxh)return!0}else if(0>=y.getScrollTop())return!0;y.scrollmom&&y.scrollmom.stop();y.lastdeltay+=i;y.debounced("mousewheely",function(){var e=y.lastdeltay;y.lastdeltay=0;y.rail.drag||y.doScrollBy(e)},15)}e.stopImmediatePropagation();return e.preventDefault()}var y=this;this.version="3.5.4";this.name="nicescroll";this.me=f;this.opt={doc:e("body"),win:!1};e.extend(this.opt,h);this.opt.snapbackspeed=80;if(o)for(var b in y.opt)"undefined"!=typeof o[b]&&(y.opt[b]=o[b]);this.iddoc=(this.doc=y.opt.doc)&&this.doc[0]?this.doc[0].id||"":"";this.ispage=/^BODY|HTML/.test(y.opt.win?y.opt.win[0].nodeName:this.doc[0].nodeName);this.haswrapper=!1!==y.opt.win;this.win=y.opt.win||(this.ispage?e(window):this.doc);this.docscroll=this.ispage&&!this.haswrapper?e(window):this.win;this.body=e("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"!=y.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"+i++;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=y.opt.overflowx;this.overflowy=y.opt.overflowy;this.nativescrollingarea=!1;this.checkarea=0;this.events=[];this.saved={};this.delaylist={};this.synclist={};this.lastdeltay=this.lastdeltax=0;this.detected=d();var w=e.extend({},this.detected);this.ishwscroll=(this.canhwscroll=w.hastransform&&y.opt.hwacceleration)&&y.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);y.opt.enablemouselockapi||(w.hasmousecapture=!1,w.haspointerlock=!1);this.delayed=function(e,t,n,r){var i=y.delaylist[e],s=(new Date).getTime();if(!r&&i&&i.tt)return!1;i&&i.tt&&clearTimeout(i.tt);if(i&&i.last+n>s&&!i.tt)y.delaylist[e]={last:s+n,tt:setTimeout(function(){y&&(y.delaylist[e].tt=0,t.call())},n)};else if(!i||!i.tt)y.delaylist[e]={last:s,tt:0},setTimeout(function(){t.call()},0)};this.debounced=function(e,t,n){var r=y.delaylist[e];(new Date).getTime();y.delaylist[e]=t;r||setTimeout(function(){var t=y.delaylist[e];y.delaylist[e]=!1;t.call()},n)};var E=!1;this.synched=function(e,t){y.synclist[e]=t;(function(){E||(u(function(){E=!1;for(e in y.synclist){var t=y.synclist[e];t&&t.call(y);y.synclist[e]=!1}}),E=!0)})();return e};this.unsynched=function(e){y.synclist[e]&&(y.synclist[e]=!1)};this.css=function(e,t){for(var n in t)y.saved.css.push([e,n,e.css(n)]),e.css(n,t[n])};this.scrollTop=function(e){return"undefined"==typeof e?y.getScrollTop():y.setScrollTop(e)};this.scrollLeft=function(e){return"undefined"==typeof e?y.getScrollLeft():y.setScrollLeft(e)};BezierClass=function(e,t,n,r,i,s,o){this.st=e;this.ed=t;this.spd=n;this.p1=r||0;this.p2=i||1;this.p3=s||0;this.p4=o||1;this.ts=(new Date).getTime();this.df=this.ed-this.st};BezierClass.prototype={B2:function(e){return 3*e*e*(1-e)},B3:function(e){return 3*e*(1-e)*(1-e)},B4:function(e){return(1-e)*(1-e)*(1-e)},getNow:function(){var e=1-((new Date).getTime()-this.ts)/this.spd,t=this.B2(e)+this.B3(e)+this.B4(e);return 0>e?this.ed:this.st+Math.round(this.df*t)},update:function(e,t){this.st=this.getNow();this.ed=e;this.spd=t;this.ts=(new Date).getTime();this.df=this.ed-this.st;return this}};if(this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"};w.hastranslate3d&&w.isios&&this.doc.css("-webkit-backface-visibility","hidden");var S=function(){var e=y.doc.css(w.trstyle);return e&&"matrix"==e.substr(0,6)?e.replace(/^.*\((.*)\)$/g,"$1").replace(/px/g,"").split(/, +/):!1};this.getScrollTop=function(e){if(!e){if(e=S())return 16==e.length?-e[13]:-e[5];if(y.timerscroll&&y.timerscroll.bz)return y.timerscroll.bz.getNow()}return y.doc.translate.y};this.getScrollLeft=function(e){if(!e){if(e=S())return 16==e.length?-e[12]:-e[4];if(y.timerscroll&&y.timerscroll.bh)return y.timerscroll.bh.getNow()}return y.doc.translate.x};this.notifyScrollEvent=document.createEvent?function(e){var t=document.createEvent("UIEvents");t.initUIEvent("scroll",!1,!0,window,1);e.dispatchEvent(t)}:document.fireEvent?function(e){var t=document.createEventObject();e.fireEvent("onscroll");t.cancelBubble=!0}:function(e,t){};w.hastranslate3d&&y.opt.enabletranslate3d?(this.setScrollTop=function(e,t){y.doc.translate.y=e;y.doc.translate.ty=-1*e+"px";y.doc.css(w.trstyle,"translate3d("+y.doc.translate.tx+","+y.doc.translate.ty+",0px)");t||y.notifyScrollEvent(y.win[0])},this.setScrollLeft=function(e,t){y.doc.translate.x=e;y.doc.translate.tx=-1*e+"px";y.doc.css(w.trstyle,"translate3d("+y.doc.translate.tx+","+y.doc.translate.ty+",0px)");t||y.notifyScrollEvent(y.win[0])}):(this.setScrollTop=function(e,t){y.doc.translate.y=e;y.doc.translate.ty=-1*e+"px";y.doc.css(w.trstyle,"translate("+y.doc.translate.tx+","+y.doc.translate.ty+")");t||y.notifyScrollEvent(y.win[0])},this.setScrollLeft=function(e,t){y.doc.translate.x=e;y.doc.translate.tx=-1*e+"px";y.doc.css(w.trstyle,"translate("+y.doc.translate.tx+","+y.doc.translate.ty+")");t||y.notifyScrollEvent(y.win[0])})}else this.getScrollTop=function(){return y.docscroll.scrollTop()},this.setScrollTop=function(e){return y.docscroll.scrollTop(e)},this.getScrollLeft=function(){return y.docscroll.scrollLeft()},this.setScrollLeft=function(e){return y.docscroll.scrollLeft(e)};this.getTarget=function(e){return!e?!1:e.target?e.target:e.srcElement?e.srcElement:!1};this.hasParent=function(e,t){if(!e)return!1;for(var n=e.target||e.srcElement||e||!1;n&&n.id!=t;)n=n.parentNode||!1;return!1!==n};var T={thin:1,medium:3,thick:5};this.getOffset=function(){if(y.isfixed)return{top:parseFloat(y.win.css("top")),left:parseFloat(y.win.css("left"))};if(!y.viewport)return y.win.offset();var e=y.win.offset(),t=y.viewport.offset();return{top:e.top-t.top+y.viewport.scrollTop(),left:e.left-t.left+y.viewport.scrollLeft()}};this.updateScrollBar=function(e){if(y.ishwscroll)y.rail.css({height:y.win.innerHeight()}),y.railh&&y.railh.css({width:y.win.innerWidth()});else{var t=y.getOffset(),n=t.top,r=t.left,n=n+p(y.win,"border-top-width",!0);y.win.outerWidth();y.win.innerWidth();var r=r+(y.rail.align?y.win.outerWidth()-p(y.win,"border-right-width")-y.rail.width:p(y.win,"border-left-width")),i=y.opt.railoffset;i&&(i.top&&(n+=i.top),y.rail.align&&i.left&&(r+=i.left));y.locked||y.rail.css({top:n,left:r,height:e?e.h:y.win.innerHeight()});y.zoom&&y.zoom.css({top:n+1,left:1==y.rail.align?r-20:r+y.rail.width+4});y.railh&&!y.locked&&(n=t.top,r=t.left,e=y.railh.align?n+p(y.win,"border-top-width",!0)+y.win.innerHeight()-y.railh.height:n+p(y.win,"border-top-width",!0),r+=p(y.win,"border-left-width"),y.railh.css({top:e,left:r,width:y.railh.width}))}};this.doRailClick=function(e,t,n){var r;y.locked||(y.cancelEvent(e),t?(t=n?y.doScrollLeft:y.doScrollTop,r=n?(e.pageX-y.railh.offset().left-y.cursorwidth/2)*y.scrollratio.x:(e.pageY-y.rail.offset().top-y.cursorheight/2)*y.scrollratio.y,t(r)):(t=n?y.doScrollLeftBy:y.doScrollBy,r=n?y.scroll.x:y.scroll.y,e=n?e.pageX-y.railh.offset().left:e.pageY-y.rail.offset().top,n=n?y.view.w:y.view.h,r>=e?t(n):t(-n)))};y.hasanimationframe=u;y.hascancelanimationframe=a;y.hasanimationframe?y.hascancelanimationframe||(a=function(){y.cancelAnimationFrame=!0}):(u=function(e){return setTimeout(e,15-Math.floor(+(new Date)/1e3)%16)},a=clearInterval);this.init=function(){y.saved.css=[];if(w.isie7mobile||w.isoperamini)return!0;w.hasmstouch&&y.css(y.ispage?e("html"):y.win,{"-ms-touch-action":"none"});y.zindex="auto";y.zindex=!y.ispage&&"auto"==y.opt.zindex?l()||"auto":y.opt.zindex;!y.ispage&&"auto"!=y.zindex&&y.zindex>s&&(s=y.zindex);y.isie&&0==y.zindex&&"auto"==y.opt.zindex&&(y.zindex="auto");if(!y.ispage||!w.cantouch&&!w.isieold&&!w.isie9mobile){var i=y.docscroll;y.ispage&&(i=y.haswrapper?y.win:y.doc);w.isie9mobile||y.css(i,{"overflow-y":"hidden"});y.ispage&&w.isie7&&("BODY"==y.doc[0].nodeName?y.css(e("html"),{"overflow-y":"hidden"}):"HTML"==y.doc[0].nodeName&&y.css(e("body"),{"overflow-y":"hidden"}));w.isios&&!y.ispage&&!y.haswrapper&&y.css(e("body"),{"-webkit-overflow-scrolling":"touch"});var o=e(document.createElement("div"));o.css({position:"relative",top:0,"float":"right",width:y.opt.cursorwidth,height:"0px","background-color":y.opt.cursorcolor,border:y.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":y.opt.cursorborderradius,"-moz-border-radius":y.opt.cursorborderradius,"border-radius":y.opt.cursorborderradius});o.hborder=parseFloat(o.outerHeight()-o.innerHeight());y.cursor=o;var u=e(document.createElement("div"));u.attr("id",y.id);u.addClass("nicescroll-rails");var a,f,h=["left","right"],p;for(p in h)f=h[p],(a=y.opt.railpadding[f])?u.css("padding-"+f,a+"px"):y.opt.railpadding[f]=0;u.append(o);u.width=Math.max(parseFloat(y.opt.cursorwidth),o.outerWidth())+y.opt.railpadding.left+y.opt.railpadding.right;u.css({width:u.width+"px",zIndex:y.zindex,background:y.opt.background,cursor:"default"});u.visibility=!0;u.scrollable=!0;u.align="left"==y.opt.railalign?0:1;y.rail=u;o=y.rail.drag=!1;y.opt.boxzoom&&!y.ispage&&!w.isieold&&(o=document.createElement("div"),y.bind(o,"click",y.doZoom),y.zoom=e(o),y.zoom.css({cursor:"pointer","z-index":y.zindex,backgroundImage:"url("+y.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0px 0px"}),y.opt.dblclickzoom&&y.bind(y.win,"dblclick",y.doZoom),w.cantouch&&y.opt.gesturezoom&&(y.ongesturezoom=function(e){1.5e.scale&&y.doZoomOut(e);return y.cancelEvent(e)},y.bind(y.win,"gestureend",y.ongesturezoom)));y.railh=!1;if(y.opt.horizrailenabled){y.css(i,{"overflow-x":"hidden"});o=e(document.createElement("div"));o.css({position:"relative",top:0,height:y.opt.cursorwidth,width:"0px","background-color":y.opt.cursorcolor,border:y.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":y.opt.cursorborderradius,"-moz-border-radius":y.opt.cursorborderradius,"border-radius":y.opt.cursorborderradius});o.wborder=parseFloat(o.outerWidth()-o.innerWidth());y.cursorh=o;var d=e(document.createElement("div"));d.attr("id",y.id+"-hr");d.addClass("nicescroll-rails");d.height=Math.max(parseFloat(y.opt.cursorwidth),o.outerHeight());d.css({height:d.height+"px",zIndex:y.zindex,background:y.opt.background});d.append(o);d.visibility=!0;d.scrollable=!0;d.align="top"==y.opt.railvalign?0:1;y.railh=d;y.railh.drag=!1}y.ispage?(u.css({position:"fixed",top:"0px",height:"100%"}),u.align?u.css({right:"0px"}):u.css({left:"0px"}),y.body.append(u),y.railh&&(d.css({position:"fixed",left:"0px",width:"100%"}),d.align?d.css({bottom:"0px"}):d.css({top:"0px"}),y.body.append(d))):(y.ishwscroll?("static"==y.win.css("position")&&y.css(y.win,{position:"relative"}),i="HTML"==y.win[0].nodeName?y.body:y.win,y.zoom&&(y.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),i.append(y.zoom)),u.css({position:"absolute",top:0}),u.align?u.css({right:0}):u.css({left:0}),i.append(u),d&&(d.css({position:"absolute",left:0,bottom:0}),d.align?d.css({bottom:0}):d.css({top:0}),i.append(d))):(y.isfixed="fixed"==y.win.css("position"),i=y.isfixed?"fixed":"absolute",y.isfixed||(y.viewport=y.getViewport(y.win[0])),y.viewport&&(y.body=y.viewport,!1==/fixed|relative|absolute/.test(y.viewport.css("position"))&&y.css(y.viewport,{position:"relative"})),u.css({position:i}),y.zoom&&y.zoom.css({position:i}),y.updateScrollBar(),y.body.append(u),y.zoom&&y.body.append(y.zoom),y.railh&&(d.css({position:i}),y.body.append(d))),w.isios&&y.css(y.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),w.isie&&y.opt.disableoutline&&y.win.attr("hideFocus","true"),w.iswebkit&&y.opt.disableoutline&&y.win.css({outline:"none"}));!1===y.opt.autohidemode?(y.autohidedom=!1,y.rail.css({opacity:y.opt.cursoropacitymax}),y.railh&&y.railh.css({opacity:y.opt.cursoropacitymax})):!0===y.opt.autohidemode||"leave"===y.opt.autohidemode?(y.autohidedom=e().add(y.rail),w.isie8&&(y.autohidedom=y.autohidedom.add(y.cursor)),y.railh&&(y.autohidedom=y.autohidedom.add(y.railh)),y.railh&&w.isie8&&(y.autohidedom=y.autohidedom.add(y.cursorh))):"scroll"==y.opt.autohidemode?(y.autohidedom=e().add(y.rail),y.railh&&(y.autohidedom=y.autohidedom.add(y.railh))):"cursor"==y.opt.autohidemode?(y.autohidedom=e().add(y.cursor),y.railh&&(y.autohidedom=y.autohidedom.add(y.cursorh))):"hidden"==y.opt.autohidemode&&(y.autohidedom=!1,y.hide(),y.locked=!1);if(w.isie9mobile)y.scrollmom=new m(y),y.onmangotouch=function(e){e=y.getScrollTop();var t=y.getScrollLeft();if(e==y.scrollmom.lastscrolly&&t==y.scrollmom.lastscrollx)return!0;var n=e-y.mangotouch.sy,r=t-y.mangotouch.sx;if(0!=Math.round(Math.sqrt(Math.pow(r,2)+Math.pow(n,2)))){var i=0>n?-1:1,s=0>r?-1:1,o=+(new Date);y.mangotouch.lazy&&clearTimeout(y.mangotouch.lazy);80a?a=Math.round(a/2):a>y.page.maxh&&(a=y.page.maxh+Math.round((a-y.page.maxh)/2)):(0>a&&(s=a=0),a>y.page.maxh&&(a=y.page.maxh,s=0));if(y.railh&&y.railh.scrollable){var f=y.rail.drag.sl-u;y.ishwscroll&&y.opt.bouncescroll?0>f?f=Math.round(f/2):f>y.page.maxw&&(f=y.page.maxw+Math.round((f-y.page.maxw)/2)):(0>f&&(o=f=0),f>y.page.maxw&&(f=y.page.maxw,o=0))}r=!1;if(y.rail.drag.dl)r=!0,"v"==y.rail.drag.dl?f=y.rail.drag.sl:"h"==y.rail.drag.dl&&(a=y.rail.drag.st);else{var i=Math.abs(i),u=Math.abs(u),l=y.opt.directionlockdeadzone;if("v"==y.rail.drag.ck){if(i>l&&u<=.3*i)return y.rail.drag=!1,!0;u>l&&(y.rail.drag.dl="f",e("body").scrollTop(e("body").scrollTop()))}else if("h"==y.rail.drag.ck){if(u>l&&i<=.3*u)return y.rail.drag=!1,!0;i>l&&(y.rail.drag.dl="f",e("body").scrollLeft(e("body").scrollLeft()))}}y.synched("touchmove",function(){y.rail.drag&&2==y.rail.drag.pt&&(y.prepareTransition&&y.prepareTransition(0),y.rail.scrollable&&y.setScrollTop(a),y.scrollmom.update(o,s),y.railh&&y.railh.scrollable?(y.setScrollLeft(f),y.showCursor(a,f)):y.showCursor(a),w.isie10&&document.selection.clear())});w.ischrome&&y.istouchcapable&&(r=!1);if(r)return y.cancelEvent(t)}}}y.onmousedown=function(e,t){if(!(y.rail.drag&&1!=y.rail.drag.pt)){if(y.locked)return y.cancelEvent(e);y.cancelScroll();y.rail.drag={x:e.clientX,y:e.clientY,sx:y.scroll.x,sy:y.scroll.y,pt:1,hr:!!t};var n=y.getTarget(e);!y.ispage&&w.hasmousecapture&&n.setCapture();y.isiframe&&!w.hasmousecapture&&(y.saved.csspointerevents=y.doc.css("pointer-events"),y.css(y.doc,{"pointer-events":"none"}));y.hasmoving=!1;return y.cancelEvent(e)}};y.onmouseup=function(e){if(y.rail.drag&&(w.hasmousecapture&&document.releaseCapture(),y.isiframe&&!w.hasmousecapture&&y.doc.css("pointer-events",y.saved.csspointerevents),1==y.rail.drag.pt))return y.rail.drag=!1,y.hasmoving&&y.triggerScrollEnd(),y.cancelEvent(e)};y.onmousemove=function(e){if(y.rail.drag&&1==y.rail.drag.pt){if(w.ischrome&&0==e.which)return y.onmouseup(e);y.cursorfreezed=!0;y.hasmoving=!0;if(y.rail.drag.hr){y.scroll.x=y.rail.drag.sx+(e.clientX-y.rail.drag.x);0>y.scroll.x&&(y.scroll.x=0);var t=y.scrollvaluemaxw;y.scroll.x>t&&(y.scroll.x=t)}else y.scroll.y=y.rail.drag.sy+(e.clientY-y.rail.drag.y),0>y.scroll.y&&(y.scroll.y=0),t=y.scrollvaluemax,y.scroll.y>t&&(y.scroll.y=t);y.synched("mousemove",function(){y.rail.drag&&1==y.rail.drag.pt&&(y.showCursor(),y.rail.drag.hr?y.doScrollLeft(Math.round(y.scroll.x*y.scrollratio.x),y.opt.cursordragspeed):y.doScrollTop(Math.round(y.scroll.y*y.scrollratio.y),y.opt.cursordragspeed))});return y.cancelEvent(e)}};if(w.cantouch||y.opt.touchbehavior)y.onpreventclick=function(e){if(y.preventclick)return y.preventclick.tg.onclick=y.preventclick.click,y.preventclick=!1,y.cancelEvent(e)},y.bind(y.win,"mousedown",y.ontouchstart),y.onclick=w.isios?!1:function(e){return y.lastmouseup?(y.lastmouseup=!1,y.cancelEvent(e)):!0},y.opt.grabcursorenabled&&w.cursorgrabvalue&&(y.css(y.ispage?y.doc:y.win,{cursor:w.cursorgrabvalue}),y.css(y.rail,{cursor:w.cursorgrabvalue}));else{var g=function(e){if(y.selectiondrag){if(e){var t=y.win.outerHeight();e=e.pageY-y.selectiondrag.top;0=t&&(e-=t);y.selectiondrag.df=e}0!=y.selectiondrag.df&&(y.doScrollBy(2*-Math.floor(y.selectiondrag.df/6)),y.debounced("doselectionscroll",function(){g()},50))}};y.hasTextSelected="getSelection"in document?function(){return 0y.page.maxh?y.doScrollTop(y.page.maxh):(y.scroll.y=Math.round(y.getScrollTop()*(1/y.scrollratio.y)),y.scroll.x=Math.round(y.getScrollLeft()*(1/y.scrollratio.x)),y.cursoractive&&y.noticeCursor());y.scroll.y&&0==y.getScrollTop()&&y.doScrollTo(Math.floor(y.scroll.y*y.scrollratio.y));return y};this.resize=y.onResize;this.lazyResize=function(e){e=isNaN(e)?30:e;y.delayed("resize",y.resize,e);return y};this._bind=function(e,t,n,r){y.events.push({e:e,n:t,f:n,b:r,q:!1});e.addEventListener?e.addEventListener(t,n,r||!1):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n};this.jqbind=function(t,n,r){y.events.push({e:t,n:n,f:r,q:!0});e(t).bind(n,r)};this.bind=function(e,t,n,r){var i="jquery"in e?e[0]:e;"mousewheel"==t?"onwheel"in y.win?y._bind(i,"wheel",n,r||!1):(e="undefined"!=typeof document.onmousewheel?"mousewheel":"DOMMouseScroll",v(i,e,n,r||!1),"DOMMouseScroll"==e&&v(i,"MozMousePixelScroll",n,r||!1)):i.addEventListener?(w.cantouch&&/mouseup|mousedown|mousemove/.test(t)&&y._bind(i,"mousedown"==t?"touchstart":"mouseup"==t?"touchend":"touchmove",function(e){if(e.touches){if(2>e.touches.length){var t=e.touches.length?e.touches[0]:e;t.original=e;n.call(this,t)}}else e.changedTouches&&(t=e.changedTouches[0],t.original=e,n.call(this,t))},r||!1),y._bind(i,t,n,r||!1),w.cantouch&&"mouseup"==t&&y._bind(i,"touchcancel",n,r||!1)):y._bind(i,t,function(e){if((e=e||window.event||!1)&&e.srcElement)e.target=e.srcElement;"pageY"in e||(e.pageX=e.clientX+document.documentElement.scrollLeft,e.pageY=e.clientY+document.documentElement.scrollTop);return!1===n.call(i,e)||!1===r?y.cancelEvent(e):!0})};this._unbind=function(e,t,n,r){e.removeEventListener?e.removeEventListener(t,n,r):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=!1};this.unbindAll=function(){for(var e=0;e(y.newscrolly-r)*(t-r)||0>(y.newscrollx-i)*(e-i))&&y.cancelScroll();!1==y.opt.bouncescroll&&(0>t?t=0:t>y.page.maxh&&(t=y.page.maxh),0>e?e=0:e>y.page.maxw&&(e=y.page.maxw));if(y.scrollrunning&&e==y.newscrollx&&t==y.newscrolly)return!1;y.newscrolly=t;y.newscrollx=e;y.newscrollspeed=n||!1;if(y.timer)return!1;y.timer=setTimeout(function(){var n=y.getScrollTop(),r=y.getScrollLeft(),i,s;i=e-r;s=t-n;i=Math.round(Math.sqrt(Math.pow(i,2)+Math.pow(s,2)));i=y.newscrollspeed&&1=y.newscrollspeed&&(i*=y.newscrollspeed);y.prepareTransition(i,!0);y.timerscroll&&y.timerscroll.tm&&clearInterval(y.timerscroll.tm);0e?e=0:e>y.page.maxh&&(e=y.page.maxh);0>t?t=0:t>y.page.maxw&&(t=y.page.maxw);if(e!=y.newscrolly||t!=y.newscrollx)return y.doScrollPos(t,e,y.opt.snapbackspeed);y.onscrollend&&y.scrollrunning&&y.triggerScrollEnd();y.scrollrunning=!1}):(this.doScrollLeft=function(e,t){var n=y.scrollrunning?y.newscrolly:y.getScrollTop();y.doScrollPos(e,n,t)},this.doScrollTop=function(e,t){var n=y.scrollrunning?y.newscrollx:y.getScrollLeft();y.doScrollPos(n,e,t)},this.doScrollPos=function(e,t,n){function r(){if(y.cancelAnimationFrame)return!0;y.scrollrunning=!0;if(c=1-c)return y.timer=u(r)||1;var e=0,t=sy=y.getScrollTop();if(y.dst.ay){var t=y.bzscroll?y.dst.py+y.bzscroll.getNow()*y.dst.ay:y.newscrolly,n=t-sy;if(0>n&&ty.newscrolly)t=y.newscrolly;y.setScrollTop(t);t==y.newscrolly&&(e=1)}else e=1;var i=sx=y.getScrollLeft();if(y.dst.ax){i=y.bzscroll?y.dst.px+y.bzscroll.getNow()*y.dst.ax:y.newscrollx;n=i-sx;if(0>n&&iy.newscrollx)i=y.newscrollx;y.setScrollLeft(i);i==y.newscrollx&&(e+=1)}else e+=1;2==e?(y.timer=0,y.cursorfreezed=!1,y.bzscroll=!1,y.scrollrunning=!1,0>t?t=0:t>y.page.maxh&&(t=y.page.maxh),0>i?i=0:i>y.page.maxw&&(i=y.page.maxw),i!=y.newscrollx||t!=y.newscrolly?y.doScrollPos(i,t):y.onscrollend&&y.triggerScrollEnd()):y.timer=u(r)||1}t="undefined"==typeof t||!1===t?y.getScrollTop(!0):t;if(y.timer&&y.newscrolly==t&&y.newscrollx==e)return!0;y.timer&&a(y.timer);y.timer=0;var i=y.getScrollTop(),s=y.getScrollLeft();(0>(y.newscrolly-i)*(t-i)||0>(y.newscrollx-s)*(e-s))&&y.cancelScroll();y.newscrolly=t;y.newscrollx=e;if(!y.bouncescroll||!y.rail.visibility)0>y.newscrolly?y.newscrolly=0:y.newscrolly>y.page.maxh&&(y.newscrolly=y.page.maxh);if(!y.bouncescroll||!y.railh.visibility)0>y.newscrollx?y.newscrollx=0:y.newscrollx>y.page.maxw&&(y.newscrollx=y.page.maxw);y.dst={};y.dst.x=e-s;y.dst.y=t-i;y.dst.px=s;y.dst.py=i;var o=Math.round(Math.sqrt(Math.pow(y.dst.x,2)+Math.pow(y.dst.y,2)));y.dst.ax=y.dst.x/o;y.dst.ay=y.dst.y/o;var f=0,l=o;0==y.dst.x?(f=i,l=t,y.dst.ay=1,y.dst.py=0):0==y.dst.y&&(f=s,l=e,y.dst.ax=1,y.dst.px=0);o=y.getTransitionSpeed(o);n&&1>=n&&(o*=n);y.bzscroll=0=y.page.maxh||s==y.page.maxw&&e>=y.page.maxw)&&y.checkContentSize();var c=1;y.cancelAnimationFrame=!1;y.timer=1;y.onscrollstart&&!y.scrollrunning&&y.onscrollstart.call(y,{type:"scrollstart",current:{x:s,y:i},request:{x:e,y:t},end:{x:y.newscrollx,y:y.newscrolly},speed:o});r();(i==y.page.maxh&&t>=i||s==y.page.maxw&&e>=s)&&y.checkContentSize();y.noticeCursor()}},this.cancelScroll=function(){y.timer&&a(y.timer);y.timer=0;y.bzscroll=!1;y.scrollrunning=!1;return y}):(this.doScrollLeft=function(e,t){var n=y.getScrollTop();y.doScrollPos(e,n,t)},this.doScrollTop=function(e,t){var n=y.getScrollLeft();y.doScrollPos(n,e,t)},this.doScrollPos=function(e,t,n){var r=e>y.page.maxw?y.page.maxw:e;0>r&&(r=0);var i=t>y.page.maxh?y.page.maxh:t;0>i&&(i=0);y.synched("scroll",function(){y.setScrollTop(i);y.setScrollLeft(r)})},this.cancelScroll=function(){});this.doScrollBy=function(e,t){var n=0,n=t?Math.floor((y.scroll.y-e)*y.scrollratio.y):(y.timer?y.newscrolly:y.getScrollTop(!0))-e;if(y.bouncescroll){var r=Math.round(y.view.h/2);n<-r?n=-r:n>y.page.maxh+r&&(n=y.page.maxh+r)}y.cursorfreezed=!1;py=y.getScrollTop(!0);if(0>n&&0>=py)return y.noticeCursor();if(n>y.page.maxh&&py>=y.page.maxh)return y.checkContentSize(),y.noticeCursor();y.doScrollTop(n)};this.doScrollLeftBy=function(e,t){var n=0,n=t?Math.floor((y.scroll.x-e)*y.scrollratio.x):(y.timer?y.newscrollx:y.getScrollLeft(!0))-e;if(y.bouncescroll){var r=Math.round(y.view.w/2);n<-r?n=-r:n>y.page.maxw+r&&(n=y.page.maxw+r)}y.cursorfreezed=!1;px=y.getScrollLeft(!0);if(0>n&&0>=px||n>y.page.maxw&&px>=y.page.maxw)return y.noticeCursor();y.doScrollLeft(n)};this.doScrollTo=function(e,t){t&&Math.round(e*y.scrollratio.y);y.cursorfreezed=!1;y.doScrollTop(e)};this.checkContentSize=function(){var e=y.getContentSize();(e.h!=y.page.h||e.w!=y.page.w)&&y.resize(!1,e)};y.onscroll=function(e){y.rail.drag||y.cursorfreezed||y.synched("scroll",function(){y.scroll.y=Math.round(y.getScrollTop()*(1/y.scrollratio.y));y.railh&&(y.scroll.x=Math.round(y.getScrollLeft()*(1/y.scrollratio.x)));y.noticeCursor()})};y.bind(y.docscroll,"scroll",y.onscroll);this.doZoomIn=function(t){if(!y.zoomactive){y.zoomactive=!0;y.zoomrestore={style:{}};var n="position top left zIndex backgroundColor marginTop marginBottom marginLeft marginRight".split(" "),r=y.win[0].style,i;for(i in n){var o=n[i];y.zoomrestore.style[o]="undefined"!=typeof r[o]?r[o]:""}y.zoomrestore.style.width=y.win.css("width");y.zoomrestore.style.height=y.win.css("height");y.zoomrestore.padding={w:y.win.outerWidth()-y.win.width(),h:y.win.outerHeight()-y.win.height()};w.isios4&&(y.zoomrestore.scrollTop=e(window).scrollTop(),e(window).scrollTop(0));y.win.css({position:w.isios4?"absolute":"fixed",top:0,left:0,"z-index":s+100,margin:"0px"});n=y.win.css("backgroundColor");(""==n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&y.win.css("backgroundColor","#fff");y.rail.css({"z-index":s+101});y.zoom.css({"z-index":s+102});y.zoom.css("backgroundPosition","0px -18px");y.resizeZoom();y.onzoomin&&y.onzoomin.call(y);return y.cancelEvent(t)}};this.doZoomOut=function(t){if(y.zoomactive)return y.zoomactive=!1,y.win.css("margin",""),y.win.css(y.zoomrestore.style),w.isios4&&e(window).scrollTop(y.zoomrestore.scrollTop),y.rail.css({"z-index":y.zindex}),y.zoom.css({"z-index":y.zindex}),y.zoomrestore=!1,y.zoom.css("backgroundPosition","0px 0px"),y.onResize(),y.onzoomout&&y.onzoomout.call(y),y.cancelEvent(t)};this.doZoom=function(e){return y.zoomactive?y.doZoomOut(e):y.doZoomIn(e)};this.resizeZoom=function(){if(y.zoomactive){var t=y.getScrollTop();y.win.css({width:e(window).width()-y.zoomrestore.padding.w+"px",height:e(window).height()-y.zoomrestore.padding.h+"px"});y.onResize();y.setScrollTop(Math.min(y.page.maxh,t))}};this.init();e.nicescroll.push(this)},m=function(e){var t=this;this.nc=e;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(e,n){t.stop();var r=t.time();t.steptime=0;t.lasttime=r;t.speedx=0;t.speedy=0;t.lastx=e;t.lasty=n;t.lastscrollx=-1;t.lastscrolly=-1};this.update=function(e,n){var r=t.time();t.steptime=r-t.lasttime;t.lasttime=r;var r=n-t.lasty,i=e-t.lastx,s=t.nc.getScrollTop(),o=t.nc.getScrollLeft(),s=s+r,o=o+i;t.snapx=0>o||o>t.nc.page.maxw;t.snapy=0>s||s>t.nc.page.maxh;t.speedx=i;t.speedy=r;t.lastx=e;t.lasty=n};this.stop=function(){t.nc.unsynched("domomentum2d");t.timer&&clearTimeout(t.timer);t.timer=0;t.lastscrollx=-1;t.lastscrolly=-1};this.doSnapy=function(e,n){var r=!1;0>n?(n=0,r=!0):n>t.nc.page.maxh&&(n=t.nc.page.maxh,r=!0);0>e?(e=0,r=!0):e>t.nc.page.maxw&&(e=t.nc.page.maxw,r=!0);r?t.nc.doScrollPos(e,n,t.nc.opt.snapbackspeed):t.nc.triggerScrollEnd()};this.doMomentum=function(e){var n=t.time(),r=e?n+e:t.lasttime;e=t.nc.getScrollLeft();var i=t.nc.getScrollTop(),s=t.nc.page.maxh,o=t.nc.page.maxw;t.speedx=0=n-r;if(0>i||i>s||0>e||e>o)r=!1;e=t.speedx&&r?t.speedx:!1;if(t.speedy&&r&&t.speedy||e){var u=Math.max(16,t.steptime);50a||a>o))e=.1;if(t.speedy&&(f=Math.floor(t.lastscrolly-t.speedy*(1-t.demulxy)),t.lastscrolly=f,0>f||f>s))e=.1;t.demulxy=Math.min(1,t.demulxy+e);t.nc.synched("domomentum2d",function(){t.speedx&&(t.nc.getScrollLeft()!=t.chkx&&t.stop(),t.chkx=a,t.nc.setScrollLeft(a));t.speedy&&(t.nc.getScrollTop()!=t.chky&&t.stop(),t.chky=f,t.nc.setScrollTop(f));t.timer||(t.nc.hideCursor(),t.doSnapy(a,f))});1>t.demulxy?t.timer=setTimeout(l,u):(t.stop(),t.nc.hideCursor(),t.doSnapy(a,f))};l()}else t.doSnapy(t.nc.getScrollLeft(),t.nc.getScrollTop())}},g=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(t,n,r){return(n=e.data(t,"__nicescroll")||!1)&&n.ishwscroll?n.getScrollTop():g.call(t)},set:function(t,n){var r=e.data(t,"__nicescroll")||!1;r&&r.ishwscroll?r.setScrollTop(parseInt(n)):g.call(t,n);return this}};e.fn.scrollTop=function(t){if("undefined"==typeof t){var n=this[0]?e.data(this[0],"__nicescroll")||!1:!1;return n&&n.ishwscroll?n.getScrollTop():g.call(this)}return this.each(function(){var n=e.data(this,"__nicescroll")||!1;n&&n.ishwscroll?n.setScrollTop(parseInt(t)):g.call(e(this),t)})};var y=e.fn.scrollLeft;e.cssHooks.pageXOffset={get:function(t,n,r){return(n=e.data(t,"__nicescroll")||!1)&&n.ishwscroll?n.getScrollLeft():y.call(t)},set:function(t,n){var r=e.data(t,"__nicescroll")||!1;r&&r.ishwscroll?r.setScrollLeft(parseInt(n)):y.call(t,n);return this}};e.fn.scrollLeft=function(t){if("undefined"==typeof t){var n=this[0]?e.data(this[0],"__nicescroll")||!1:!1;return n&&n.ishwscroll?n.getScrollLeft():y.call(this)}return this.each(function(){var n=e.data(this,"__nicescroll")||!1;n&&n.ishwscroll?n.setScrollLeft(parseInt(t)):y.call(e(this),t)})};var b=function(t){var n=this;this.length=0;this.name="nicescrollarray";this.each=function(e){for(var t=0,r=0;t