/* jquery.nicescroll -- version 2.3.0 -- copyright 2011 InuYaksa*2011 -- licensed under the MIT -- -- http://areaaperta.com/nicescroll -- https://github.com/inuyaksa/jquery.nicescroll -- */ (function(g){var l=false,m=false,o=function(){var f=document.getElementsByTagName("script"),f=f[f.length-1].src.split("?")[0];return f.split("/").length>0?f.split("/").slice(0,-1).join("/")+"/":""}(),q=function(f){var b=this;this.version="2.3.0";this.name="nicescroll";this.opt={doc:g("body"),win:false,zindex:9E3,cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"5px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:48,touchbehavior:false, hwacceleration:true,usetransition:true,boxzoom:false,dblclickzoom:true,gesturezoom:true,grabcursorenabled:true,autohidemode:true,background:"",iframeautoresize:true};if(f)for(var h in b.opt)f[h]!==void 0&&(b.opt[h]=f[h]);this.id=b.opt.doc[0].id||"";this.doc=b.opt.doc;this.ispage=b.doc[0].nodeName=="BODY"||b.doc[0].nodeName=="HTML";this.haswrapper=b.opt.win!==false;this.win=b.opt.win||(this.ispage?g(window):this.doc);this.docscroll=this.ispage?g(window):this.win;this.iframe=false;this.isiframe=this.doc[0].nodeName== "IFRAME"&&this.win[0].nodeName=="IFRAME";this.istextarea=this.win[0].nodeName=="TEXTAREA";this.page=this.view=this.onkeypress=this.onmousewheel=this.onmousemove=this.onmouseup=this.onmousedown=false;this.scroll={x:0,y:0};this.scrollratio={x:0,y:0};this.cursorheight=20;this.scrollvaluemax=0;do this.id="ascrail"+Math.round(Math.random()*99999);while(document.getElementById(this.id));this.hasmousefocus=this.hasfocus=this.zoomactive=this.zoom=this.cursorfreezed=this.cursor=this.rail=false;this.visibility= true;this.locked=false;var i=document.createElement("DIV");this.isopera="opera"in window;this.isieold=(this.isie="all"in document&&"attachEvent"in i&&!this.isopera)&&!("msInterpolationMode"in i.style);this.isie7=this.isie&&!this.isieold&&(!("documentMode"in document)||document.documentMode==7);this.isie8=this.isie&&"documentMode"in document&&document.documentMode==8;this.isie9=this.isie&&"performance"in window&&document.documentMode>=9;this.ismozilla="MozAppearance"in i.style;(this.cantouch="ontouchstart"in document.documentElement)&&/iphone|ipad|ipod/i.test(navigator.platform)?(this.isios=true,this.isios4=!("seal"in Object)):this.isios4=this.isios=false;if(b.opt.hwacceleration){if((this.trstyle=window.opera?"OTransform":document.all?"msTransform":i.style.webkitTransform!==void 0?"webkitTransform":i.style.MozTransform!==void 0?"MozTransform":false)&&i.style[this.trstyle]===void 0)this.trstyle=false;if(this.hastransform=this.trstyle!=false)i.style[this.trstyle]="translate3d(1px,2px,3px)",this.hastranslate3d= /translate3d/.test(i.style[this.trstyle]);this.transitionstyle=false;this.prefixstyle="";this.transitionend=false;var f="transition,webkitTransition,MozTransition,OTransition,msTransition,KhtmlTransition".split(","),p=",-webkit-,-moz-,-o-,-ms-,-khtml-".split(","),j="transitionEnd,webkitTransitionEnd,transitionend,oTransitionEnd,msTransitionEnd,KhtmlTransitionEnd".split(",");for(h=0;h1.5&&b.doZoomIn(c);c.scale<0.8&&b.doZoomOut(c);return b.cancelEvent(c)});b.ispage?(d.css({position:"fixed", top:"0px",right:"0px",height:"100%"}),b.doc.append(d)):b.ishwscroll?(b.win.css("position")=="static"&&b.win.css("position","relative"),b.zoom&&(b.zoom.css({position:"absolute",top:1,right:0,"margin-right":d.width+2}),b.win.append(b.zoom)),d.css({position:"absolute",top:0,right:0}),b.win.append(d)):(b.updateScrollBar(),g("body").append(d),b.zoom&&g("body").append(b.zoom));if(b.opt.autohidemode===false)b.autohidedom=false;else if(b.opt.autohidemode===true)b.autohidedom=b.rail;else if(b.opt.autohidemode== "cursor")b.autohidedom=b.cursor;b.bind(window,"resize",b.onResize);b.bind(window,"orientationchange",b.onResize);!b.ispage&&!b.haswrapper&&b.bind(b.win,b.isie&&!b.isie9?"propertychange":"DOMAttrModified",b.onAttributeChange);!b.ispage&&b.opt.boxzoom&&g(window).resize(b.resizeZoom);b.istextarea&&b.win.mouseup(b.onResize);b.onResize();b.cantouch||b.opt.touchbehavior?(b.onmousedown=function(c){if(b.locked)return b.cancelEvent(c);b.rail.drag={x:c.pageX,y:c.pageY,sx:b.scroll.x,sy:b.scroll.y,st:b.getScrollTop(), lx:c.pageX,ly:c.pageY,nx:c.pageX,ny:c.pageY,tt:(new Date).getTime(),lt:(new Date).getTime()};return b.cancelEvent(c)},b.onmouseup=function(c){if(b.rail.drag)return b.doScrollMomentum(b.rail.drag),b.rail.drag=false,b.cancelEvent(c)},b.onmousemove=function(c){if(b.rail.drag){var d=c.pageY-b.rail.drag.y;b.rail.drag.ly=b.rail.drag.ny;b.rail.drag.ny=c.pageY;b.rail.drag.lt=(new Date).getTime();b.scroll.y=Math.round((b.rail.drag.st-d)*(1/b.scrollratio.y));if(b.scroll.y<0)b.scroll.y=0;if(b.scroll.y>b.scrollvaluemax)b.scroll.y= b.scrollvaluemax;b.showCursor();b.doScrollTo(b.rail.drag.st-d,true);return b.cancelEvent(c)}},b.cursorgrabvalue&&b.win.css({cursor:b.cursorgrabvalue})):(b.onmousedown=function(c){if(b.locked)return b.cancelEvent(c);b.rail.drag={x:c.screenX,y:c.screenY,sx:b.scroll.x,sy:b.scroll.y};return b.cancelEvent(c)},b.onmouseup=function(c){if(b.rail.drag)return b.rail.drag=false,b.cancelEvent(c)},b.onmousemove=function(c){if(b.rail.drag){b.scroll.y=b.rail.drag.sy+(c.screenY-b.rail.drag.y);if(b.scroll.y<0)b.scroll.y= 0;var d=b.scrollvaluemax;if(b.scroll.y>d)b.scroll.y=d;b.showCursor();b.cursorfreezed=true;b.doScroll(Math.round(b.scroll.y*b.scrollratio.y));return b.cancelEvent(c)}});(b.cantouch||b.opt.touchbehavior)&&b.bind(b.win,"mousedown",b.onmousedown);b.bind(b.win,"mouseup",b.onmouseup);b.bind(b.rail,"mousedown",b.onmousedown);b.bind(b.rail,"mouseup",function(c){b.rail.drag=false;b.hideCursor();return b.cancelEvent(c)});b.bind(document,"mouseup",b.onmouseup);b.bind(document,"mousemove",b.onmousemove);b.cantouch|| (b.rail.mouseenter(function(){b.showCursor();b.rail.active=true}),b.rail.mouseleave(function(){b.rail.active=false;b.rail.drag||b.hideCursor()}),b.isiframe||b.bind(b.isie&&b.ispage?document:b.docscroll,"mousewheel",b.onmousewheel),b.bind(b.rail,"mousewheel",b.onmousewheel));!b.ispage&&!b.cantouch&&(b.win.attr("tabindex")||b.win.attr({tabindex:(new Date).getTime()}),b.win.focus(function(c){l=b.getTarget(c).id||true;b.hasfocus=true;b.noticeCursor()}),b.win.blur(function(){l=false;b.hasfocus=false}), b.win.mouseenter(function(c){m=b.getTarget(c).id||true;b.hasmousefocus=true;b.noticeCursor()}),b.win.mouseleave(function(){m=false;b.hasmousefocus=false}));b.onkeypress=function(c){var c=c?c:window.e,d=b.getTarget(c);if(d&&/INPUT|TEXTAREA|SELECT/.test(d.nodeName)&&(!d.getAttribute("type")&&!d.type||!/submit|button|cancel/i.tp))return true;if(b.hasfocus||b.hasmousefocus&&!l||b.ispage&&!l&&!m){d=c.keyCode;if(b.locked&&d!=27)return b.cancelEvent(c);var e=true;switch(d){case 38:case 63233:b.doScrollBy(72, true);e=false;break;case 40:case 63235:b.doScrollBy(-72,true);e=false;break;case 33:case 63276:b.doScrollBy(b.view.h,true);e=false;break;case 34:case 63277:b.doScrollBy(-b.view.h,true);e=false;break;case 36:case 63273:b.doScrollTo(0,true);e=false;break;case 35:case 63275:b.doScrollTo(b.page.h,true);e=false;break;case 27:b.zoomactive&&(b.doZoom(),e=false)}if(!e)return b.cancelEvent(c)}};b.bind(document,b.isopera?"keypress":"keydown",b.onkeypress)}if(this.doc[0].nodeName=="IFRAME"){var e=function(){var c= "contentDocument"in this?this.contentDocument:this.contentWindow.document;if(b.isiframe)b.docscroll=g(c),b.iframe={html:b.doc.contents().find("html")[0],body:b.doc.contents().find("body")[0]};if(b.opt.iframeautoresize&&!b.isiframe){b.win.scrollTop(0);b.doc.height("");var d=b.doc.contents(),d=Math.max(d.find("html").attr("scrollHeight"),d.find("body").attr("scrollHeight"));b.doc.height(d)}b.onResize();b.isie7&&g(c).find("html").css({"overflow-y":"hidden"});g(c.body).css({"overflow-y":"hidden"});"contentWindow"in this?b.bind(this.contentWindow,"scroll",b.onscroll):b.bind(c,"scroll",b.onscroll);b.bind(c,"mouseup",b.onmouseup);b.bind(c,"mousewheel",b.onmousewheel);b.bind(c,b.isopera?"keypress":"keydown",b.onkeypress);if(b.cantouch||b.opt.touchbehavior)b.bind(c,"mousedown",b.onmousedown),b.cursorgrabvalue&&g(c).css({cursor:b.cursorgrabvalue});b.bind(c,"mousemove",b.onmousemove);b.zoom&&(b.opt.dblclickzoom&&b.bind(c,"dblclick",b.doZoom),b.cantouch&&b.opt.gesturezoom&&b.bind(c,"gesturechange",function(c){c.scale> 1.5&&b.doZoomIn(c);c.scale<0.8&&b.doZoomOut(c);return b.cancelEvent(c)}))};this.doc[0].readyState&&this.doc[0].readyState=="complete"&&setTimeout(function(){e.call(b.doc[0],false)},500);this.doc.load(e)}};this.showCursor=function(){if(b.cursortimeout)clearTimeout(b.cursortimeout),b.cursortimeout=0;b.rail&&(b.autohidedom&&b.autohidedom.stop().css({opacity:b.opt.cursoropacitymax}),b.cursor.css({height:b.cursorheight,top:b.scroll.y}),b.zoom&&b.zoom.stop().css({opacity:b.opt.cursoropacitymax}))};this.hideCursor= function(c){if(!b.cursortimeout&&b.rail&&b.autohidedom)b.cursortimeout=setTimeout(function(){b.rail.active||(b.autohidedom.stop().animate({opacity:b.opt.cursoropacitymin}),b.zoom&&b.zoom.stop().animate({opacity:b.opt.cursoropacitymin}));b.cursortimeout=0},c||800)};this.noticeCursor=function(c){b.showCursor();b.hideCursor(c)};this.getContentSize=function(){var c=b.ispage?{w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}: b.haswrapper?{w:b.doc.outerWidth()+parseInt(b.win.css("paddingLeft"))+parseInt(b.win.css("paddingRight")),h:b.doc.outerHeight()+parseInt(b.win.css("paddingTop"))+parseInt(b.win.css("paddingBottom"))}:b.iframe?{w:Math.max(b.iframe.html.scrollWidth,b.iframe.body.scrollWidth),h:Math.max(b.iframe.html.scrollHeight,b.iframe.body.scrollHeight)}:{w:b.docscroll[0].scrollWidth,h:b.docscroll[0].scrollHeight};c.w-=1;c.h-=1;return c};this.onAttributeChange=function(c){if(c&&c.target){if(c.target!==b.win[0]&& c.target!==b.doc[0])return true;if((c="attrChange"in c?c.attrName:"propertyName"in c?c.propertyName:false)&&/width|height|style|block/i.test(c)){if(b.lastattributechange)b.lastattributechange=clearTimeout(b.lastattributechange);b.lastattributechange=setTimeout(function(){b.lastattributechange=0;b.onResize()},60)}}};this.onResize=function(){if(!b.haswrapper&&!b.ispage){var c=b.win.css("display")!="none";c&&!b.visibility&&b.show();!c&&b.visibility&&b.hide();if(!b.visibility)return false}b.view={w:b.ispage? b.win.width():b.win.innerWidth(),h:b.ispage?b.win.height():b.win.innerHeight()};b.page=b.getContentSize();if(b.view.h>=b.page.h)return b.hide(),b.scrollvaluemax=0,b.scroll.y=0,b.scrollratio={x:0,y:0},b.cursorheight=0,b.locked=true,b.setScrollTop(0),false;else b.visibility||b.show();b.locked=false;b.istextarea&&b.win.css("resize")&&b.win.css("resize")!="none"&&(b.view.h-=20);b.ispage||b.updateScrollBar(b.view);b.cursorheight=Math.min(b.view.h,Math.round(b.view.h*(b.view.h/b.page.h)));b.scrollvaluemax= b.view.h-b.cursorheight-b.cursor.hborder-2;b.scrollratio={x:0,y:(b.page.h-b.view.h)/b.scrollvaluemax};b.scroll.y=Math.round(b.getScrollTop()*(1/b.scrollratio.y));b.noticeCursor()};this.bind=function(c,d,e,f){var g=c.length?c[0]:c;g.addEventListener?(b.cantouch&&/mouseup|mousedown|mousemove/.test(d)&&g.addEventListener(d=="mousedown"?"touchstart":d=="mouseup"?"touchend":"touchmove",function(b){if(b.touches.length<2){var c=b.touches.length>0?b.touches[0]:b;c.original=b;e.call(this,c)}},f||false),g.addEventListener(d, e,f||false),d=="mousewheel"&&g.addEventListener("DOMMouseScroll",e,f||false),b.cantouch&&d=="mouseup"&&g.addEventListener("touchcancel",e,f||false)):g.attachEvent?g.attachEvent("on"+d,function(c){if(c&&!("pageY"in c)&&"screenY"in c)c.pageX=c.screenX,c.pageY=c.screenY;return e.call(g,c)===false||f===false?b.cancelEvent(c):true}):g["on"+d]=function(c){return e.call(g,c)===false||f===false?b.cancelEvent(c):true}};this.cancelEvent=function(c){c=b.cantouch?c.original?c.original:c||false:c?c:window.event|| false;if(!c)return false;c.stopPropagation&&c.stopPropagation();c.preventDefault&&c.preventDefault();c.cancelBubble=true;c.cancel=true;return c.returnValue=false};this.show=function(){b.visibility=true;b.rail.css("display","block")};this.hide=function(){b.visibility=false;b.rail.css("display","none")};this.onmousewheel=function(c){if(b.locked)return b.cancelEvent(c);c=c?c:window.event;if(b.rail.drag)return b.cancelEvent(c);var d=0;(d=c.detail?c.detail*-1:c.wheelDelta/40)&&b.doScrollBy(d*b.opt.mousescrollstep, true);return b.cancelEvent(c)};this.stop=function(){b.timer&&n(b.timer);b.timer=0;b.cursorfreezed=false;b.scroll.y=Math.round(b.getScrollTop()*(1/b.scrollratio.y));b.noticeCursor()};b.ishwscroll&&b.hastransition&&b.opt.usetransition?(this.prepareTransition=function(c){var d=Math.round(b.opt.scrollspeed*10),c=Math.min(d,Math.round(c/20*b.opt.scrollspeed)),c=c>20?b.prefixstyle+"transform "+c+"ms ease-out 0s":"";if(!b.lasttransitionstyle||b.lasttransitionstyle!=c)b.lasttransitionstyle=c,b.doc.css(b.transitionstyle, c)},this.doScroll=function(c){b.newscrolly=c;if(!b.timer)b.timer=setTimeout(function(){var c=b.getScrollTop();b.prepareTransition(c>b.newscrolly?c-b.newscrolly:b.newscrolly-c);b.setScrollTop(b.newscrolly);b.timer=0},b.opt.scrollspeed),b.noticeCursor()}):this.doScroll=function(c){function d(){g=(new Date).getTime();if(g0?Math.ceil(c*e):Math.floor(c*e),c=b.getScrollTop()+c;b.setScrollTop(c);c== b.newscrolly?(b.timer=0,b.cursorfreezed=false):b.timer=k(d)}b.newscrolly=c;if(!b.timer){var e=0.25,g=0,f=0;b.timer=k(d);b.noticeCursor()}};this.doScrollBy=function(c,d){d&&(c=Math.round(c*1/b.scrollratio.y));var e=b.scroll.y-c;e<0&&(e=0);var g=b.scrollvaluemax;e>g&&(e=g);b.cursorfreezed=false;b.doScroll(Math.floor(e*b.scrollratio.y))};this.doScrollTo=function(c,d){ny=d?Math.round(c*1/b.scrollratio.y):c;ny<0&&(c=0);var e=b.scrollvaluemax;ny>e&&(c=d?Math.round(e*b.scrollratio.y):e);b.cursorfreezed= false;b.doScroll(d?c:Math.round(c*b.scrollratio.y))};this.doScrollMomentum=function(c){var d=c.ly-c.ny,c=(new Date).getTime()-c.lt;(d=Math.floor(d*3/((c+1)*0.2)))&&b.doScrollBy(d,true)};b.onscroll=function(){var c=(new Date).getTime();if(!b.lastcontentcheck||b.lastcontentcheck