Browse Source

2.5.1 - bugfix: scroll stuck

- optimized scroll event dispatcher for hwaccelerated scroll
- detection of window object on bind function (addEventListener access error)
- scrolling up with mouse wheel can stuck
- scrollTop override
Inuyaksa 13 years ago
parent
commit
3171ea3980
5 changed files with 144 additions and 132 deletions
  1. 2 1
      README
  2. 11 1
      changelog_2.5.1.txt
  3. 49 49
      demo/js/jquery.nicescroll.min.js
  4. 33 32
      jquery.nicescroll.js
  5. 49 49
      jquery.nicescroll.min.js

+ 2 - 1
README

@@ -1,9 +1,10 @@
 jquery.nicescroll
-v. 2.5.0 12-05-2011
+v. 2.5.1 12-10-2011
 copyright 2011 InuYaksa*2011
 licensed under the MIT
 http://areaaperta.com/nicescroll
 https://github.com/inuyaksa/jquery.nicescroll
+Nicescroll as a Greasemonkey plugin: http://userscripts.org/scripts/show/119910
 
 
 Nicescroll (as nice scroll for browsers) is a jquery (since 1.5) plugin, for nice scrollbars with a very similar ios/mobile style.

+ 11 - 1
changelog_2.5.0.txt → changelog_2.5.1.txt

@@ -1,7 +1,17 @@
-Changelog nicescroll release 2.5.0
+Changelog nicescroll release 2.5.1
 http://areaaperta.com/nicescroll
 https://github.com/inuyaksa/jquery.nicescroll
 
+Changed features
+- optimized scroll event dispatcher for hwaccelerated scroll
+
+Fixes
+- detection of window object on bind function (addEventListener access error)
+- scrolling up with mouse wheel can stuck
+- scrollTop override
+
+
+Changelog nicescroll release 2.5.0
 
 New features
 - getNiceScroll returns nicescrollarray object to manage multiple scrollbars at the same time

+ 49 - 49
demo/js/jquery.nicescroll.min.js

@@ -1,5 +1,5 @@
 /* jquery.nicescroll
--- version 2.5.0
+-- version 2.5.1
 -- copyright 2011 InuYaksa*2011
 -- licensed under the MIT
 --
@@ -7,51 +7,51 @@
 -- https://github.com/inuyaksa/jquery.nicescroll
 --
 */
-(function(e){var l=false,n=false,q=5E3,r=2E3,s=function(){var e=document.getElementsByTagName("script"),e=e[e.length-1].src.split("?")[0];return e.split("/").length>0?e.split("/").slice(0,-1).join("/")+"/":""}(),v=function(g,d){var b=this;this.version="2.5.0";this.name="nicescroll";this.me=d;this.opt={doc:e("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,cursorminheight:20};if(g)for(var i in b.opt)g[i]!==void 0&&(b.opt[i]=g[i]);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?e(window):this.doc);this.docscroll=this.ispage?e(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;this.scrollmom=false;do this.id="ascrail"+r++;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;this.events=[];this.saved={};var h=document.createElement("DIV");this.isopera="opera"in window;this.isieold=(this.isie="all"in document&&"attachEvent"in h&&!this.isopera)&&!("msInterpolationMode"in h.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 h.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":h.style.webkitTransform!==void 0?"webkitTransform":h.style.MozTransform!==void 0?"MozTransform":false)&&h.style[this.trstyle]===void 0)this.trstyle=false;if(this.hastransform=this.trstyle!=
-false)h.style[this.trstyle]="translate3d(1px,2px,3px)",this.hastranslate3d=/translate3d/.test(h.style[this.trstyle]);this.transitionstyle=false;this.prefixstyle="";this.transitionend=false;var o="transition,webkitTransition,MozTransition,OTransition,msTransition,KhtmlTransition".split(","),t=",-webkit-,-moz-,-o-,-ms-,-khtml-".split(","),j="transitionEnd,webkitTransitionEnd,transitionend,oTransitionEnd,msTransitionEnd,KhtmlTransitionEnd".split(",");for(i=0;i<o.length;i++)if(o[i]in h.style){this.transitionstyle=
-o[i];this.prefixstyle=t[i];this.transitionend=j[i];break}this.hastransition=this.transitionstyle}else this.transitionend=this.hastransition=this.transitionstyle=this.hastranslate3d=this.hastransform=this.trstyle=false;this.cursorgrabvalue="";if(b.opt.grabcursorenabled&&b.opt.touchbehavior)this.cursorgrabvalue=function(){if(!b.isie||b.isie9)for(var c=["grab","-moz-grab","-webkit-grab"],d=0;d<c.length;d++){var f=c[d];h.style.cursor=f;if(h.style.cursor==f)return f}return"url(http://www.google.com/intl/en_ALL/mapfiles/openhand.cur),n-resize"}();
-h=null;this.ishwscroll=b.hastransform&&b.opt.hwacceleration&&b.haswrapper;this.scrollTop=function(c){return c===void 0?b.getScrollTop():b.setScrollTop(c)};this.ishwscroll?(b.doc.translate={x:0,y:0},this.getScrollTop=function(){return b.doc.translate.y},this.setScrollTop=this.hastranslate3d?function(c,d){b.doc.css(b.trstyle,"translate3d(0px,"+c*-1+"px,0px)");b.doc.translate.y=c;if(!d)if(document.createEvent){var f=document.createEvent("UIEvents");f.initUIEvent("scroll",false,true,window,1);b.docscroll[0].dispatchEvent(f)}else f=
-document.createEventObject(),b.docscroll[0].fireEvent("onscroll"),f.cancelBubble=true}:function(c,d){b.doc.css(b.trstyle,"translate(0px,"+c*-1+"px)");b.doc.translate.y=c;if(!d)if(document.createEvent){var f=document.createEvent("UIEvents");f.initUIEvent("scroll",false,true,window,1);b.docscroll[0].dispatchEvent(f)}else f=document.createEventObject(),b.docscroll[0].fireEvent("onscroll"),f.cancelBubble=true}):(this.getScrollTop=function(){return b.docscroll.scrollTop()},this.setScrollTop=function(c){return b.docscroll.scrollTop(c)});
-this.getTarget=function(b){return!b?false:b.target?b.target:b.srcElement?b.srcElement:false};this.hasParent=function(b,d){if(!b)return false;for(var f=b.target||b.srcElement||b||false;f&&f.id!=d;)f=f.parentNode||false;return f!==false};this.updateScrollBar=function(c){if(b.ishwscroll)b.rail.css({height:b.win.innerHeight()});else{var d=b.win.offset();d.top+=2;var f=(b.win.outerWidth()-b.win.innerWidth())/2;d.left+=b.win.innerWidth()+f-b.rail.width-1;b.rail.css({position:"absolute",top:d.top,left:d.left,
-height:c?c.h:b.win.innerHeight()});b.zoom&&b.zoom.css({position:"absolute",top:d.top+1,left:d.left-20})}};var k=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||false,m=window.cancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||false;b.hasanimationframe=k;
-b.hascancelanimationframe=m;b.hasanimationframe?b.hascancelanimationframe||(m=function(){b.cancelAnimationFrame=true}):(k=function(b){return setTimeout(b,1E3/60)},m=clearInterval);this.init=function(){b.saved.css=[];b.ispage&&b.saved.css.push([b.doc,"overflow-y",b.doc.css("overflow-y")]);b.ispage||b.saved.css.push([b.docscroll,"overflow-y",b.docscroll.css("overflow-y")]);b.ispage&&b.isie7&&b.saved.css.push([e("html"),"overflow-y",e("html").css("overflow-y")]);if(!b.ispage||!b.cantouch&&!b.isieold){b.ispage?
-b.doc.css({"overflow-y":"hidden"}):b.docscroll.css({"overflow-y":"hidden"});b.ispage&&b.isie7&&e("html").css({"overflow-y":"hidden"});var c=e(document.createElement("div"));c.css({position:"relative",top:0,"float":"right",width:b.opt.cursorwidth,height:"0px","background-color":b.opt.cursorcolor,border:b.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":b.opt.cursorborderradius,"-moz-border-radius":b.opt.cursorborderradius,"border-radius":b.opt.cursorborderradius});c.hborder=
-parseFloat(c.outerHeight()-c.innerHeight());b.cursor=c;var d=e(document.createElement("div"));d.attr("id",b.id);d.width=3+Math.max(parseFloat(b.opt.cursorwidth),c.outerWidth());d.css({"padding-left":"0px","padding-right":"1px",width:d.width+"px",zIndex:b.ispage?b.opt.zindex:b.opt.zindex+2,background:b.opt.background});d.append(c);b.rail=d;c=false;if(b.opt.boxzoom&&!b.ispage&&!b.isieold)c=document.createElement("div"),b.bind(c,"click",b.doZoom),b.zoom=e(c),b.zoom.css({cursor:"pointer","z-index":b.opt.zindex,
-backgroundImage:"url("+s+"zoomico.png)",height:18,width:18,backgroundPosition:"0px 0px"}),b.opt.dblclickzoom&&b.bind(b.win,"dblclick",b.doZoom),b.cantouch&&b.opt.gesturezoom&&b.bind(b.win,"gestureend",function(c){c.scale>1.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+4}),b.win.append(b.zoom)),d.css({position:"absolute",top:0,right:0}),b.win.append(d)):(b.updateScrollBar(),e("body").append(d),b.zoom&&e("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&&e(window).resize(b.resizeZoom);b.istextarea&&b.win.mouseup(b.onResize);b.onResize();b.cantouch||b.opt.touchbehavior?(b.scrollmom={y:new u(b)},b.onmousedown=function(c){if(!b.locked&&(b.cancelScroll(),b.rail.drag={x:c.pageX,y:c.pageY,sx:b.scroll.x,sy:b.scroll.y,st:b.getScrollTop()},b.hasmoving=false,b.scrollmom.y.reset(c.pageY),!b.cantouch))return b.cancelEvent(c)},b.onmouseup=function(c){if(b.rail.drag&&(b.scrollmom.y.doMomentum(),b.rail.drag=
-false,b.hasmoving))return b.hasmoving=false,b.cancelEvent(c)},b.onmousemove=function(c){if(b.rail.drag){b.hasmoving=true;var d=c.pageY-b.rail.drag.y;b.scrollmom.y.update(c.pageY);b.showCursor(b.rail.drag.st-d);b.prepareTransition&&b.prepareTransition(0);b.setScrollTop(b.rail.drag.st-d);return b.cancelEvent(c)}},b.cursorgrabvalue&&(b.saved.css.push([b.win,"cursor",b.win.css("cursor")]),b.win.css({cursor:b.cursorgrabvalue}))):(b.onmousedown=function(c){if(b.locked)return b.cancelEvent(c);b.cancelScroll();
-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.hasmoving=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:q++}),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){n=b.getTarget(c).id||true;b.hasmousefocus=true;b.noticeCursor()}),b.win.mouseleave(function(){n=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&&!n){d=c.keyCode;if(b.locked&&d!=27)return b.cancelEvent(c);var f=true;switch(d){case 38:case 63233:b.doScrollBy(72,true);f=false;break;case 40:case 63235:b.doScrollBy(-72,true);f=false;break;case 33:case 63276:b.doScrollBy(b.view.h,true);f=false;break;case 34:case 63277:b.doScrollBy(-b.view.h,true);f=false;break;case 36:case 63273:b.doScrollTo(0,
-true);f=false;break;case 35:case 63275:b.doScrollTo(b.page.maxh,true);f=false;break;case 27:b.zoomactive&&(b.doZoom(),f=false)}if(!f)return b.cancelEvent(c)}};b.bind(document,b.isopera?"keypress":"keydown",b.onkeypress)}if(this.doc[0].nodeName=="IFRAME"){var f=function(){var c="contentDocument"in this?this.contentDocument:this.contentWindow.document;if(b.isiframe)b.docscroll=e(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&&b.saved.css.push([e(c).find("html"),"overflow-y",e(c).find("html").css("overflow-y")]);b.saved.css.push([e(c.body),"overflow-y",e(c.body).css("overflow-y")]);b.isie7&&e(c).find("html").css({"overflow-y":"hidden"});e(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&&(b.saved.css.push([e(c),"cursor",e(c).css("cursor")]),e(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(){f.call(b.doc[0],false)},500);this.doc.load(f)}};this.showCursor=function(c){if(b.cursortimeout)clearTimeout(b.cursortimeout),b.cursortimeout=0;if(b.rail){b.autohidedom&&b.autohidedom.stop().css({opacity:b.opt.cursoropacitymax});if(typeof c!="undefined")b.scroll.y=Math.round(c*1/b.scrollratio.y);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.resize=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();b.page.maxh=b.page.h-b.view.h;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.cursorheight=Math.max(b.opt.cursorminheight,b.cursorheight);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();return b};this._bind=function(c,d,f,e){b.events.push({e:c,n:d,f:f});c.addEventListener?c.addEventListener(d,f,e||false):c.attachEvent?c.attachEvent("on"+d,f):c["on"+d]=f};this.bind=function(c,
-d,f,e){var g=c.length?c[0]:c;g.addEventListener?(b.cantouch&&/mouseup|mousedown|mousemove/.test(d)&&b._bind(g,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;f.call(this,c)}},e||false),b._bind(g,d,f,e||false),d=="mousewheel"&&b._bind(g,"DOMMouseScroll",f,e||false),b.cantouch&&d=="mouseup"&&b._bind(g,"touchcancel",f,e||false)):b._bind(g,d,function(c){if(c&&!("pageY"in c)&&"screenY"in c)c.pageX=c.screenX,
-c.pageY=c.screenY;return f.call(g,c)===false||e===false?b.cancelEvent(c):true})};this._unbind=function(b,d,f){b.removeEventListener?b.removeEventListener(d,f,false):b.detachEvent?b.detachEvent("on"+d,f):b["on"+d]=false};this.unbindAll=function(){for(var c=0;c<b.events.length;c++){var d=b.events[c];b._unbind(d.e,d.n,d.f)}};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");return b};this.hide=function(){b.visibility=false;b.rail.css("display","none");return b};this.remove=function(){b.doZoomOut();b.unbindAll();b.events=[];b.rail.remove();b.zoom&&b.zoom.remove();b.cursor=false;b.rail=false;b.zoom=false;for(var c=0;c<b.saved.css.length;c++){var d=b.saved.css[c];d[0].css(d[1],typeof d[2]=="undefined"?"":d[2])}b.saved=false;b.me.data("__nicescroll",
-"");return b};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;if(d=c.detail?c.detail*-1:c.wheelDelta/40)b.scrollmom&&b.scrollmom.y.stop(),b.doScrollBy(d*b.opt.mousescrollstep,true);return b.cancelEvent(c)};this.stop=function(){b.cancelScroll();b.scrollmon&&b.scrollmon.stop();b.cursorfreezed=false;b.scroll.y=Math.round(b.getScrollTop()*(1/b.scrollratio.y));b.noticeCursor();return b};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)return false;b.timer=setTimeout(function(){var c=b.getScrollTop(),c=Math.abs(c-b.newscrolly);b.prepareTransition(c);b.timer=setTimeout(function(){b.setScrollTop(b.newscrolly);
-b.timer=0},15)},b.opt.scrollspeed);b.noticeCursor()},this.cancelScroll=function(){var c=b.getScrollTop();b.prepareTransition(0);b.setScrollTop(c);b.noticeCursor();return b}):(this.doScroll=function(c){function d(){if(b.cancelAnimationFrame)return true;g=(new Date).getTime();if(g<h)return b.timer=k(d)||1;h=Math.floor((new Date).getTime()+b.opt.scrollspeed/2);g=0;var c=b.getScrollTop();if(b.newspeedy)if(c+=b.newspeedy.v,b.newspeedy.v>0){if(c>=b.newspeedy.x)b.newspeedy=false}else{if(c<=b.newspeedy.x)b.newspeedy=
-false}else c=b.newscrolly-b.getScrollTop(),c=c>0?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)||1}b.newscrolly=c;var f=c-b.getScrollTop();b.newspeedy=f*f>100?{x:c-Math.round(f/6),v:Math.round(f/6*5/8)+1}:false;if(!b.timer){var e=0.25,g=0,h=0;b.cancelAnimationFrame=false;b.timer=k(d)||1;b.noticeCursor()}},this.cancelScroll=function(){b.timer&&m(b.timer);b.timer=0;return b});this.doScrollBy=function(c,d){var f=0,
-f=d?b.timer?b.newscrolly-c:b.getScrollTop()-c:Math.floor((b.scroll.y-c)*b.scrollratio.y);if(f<0)f=0;else if(f>b.page.maxh)f=b.page.maxh;b.cursorfreezed=false;b.doScroll(f)};this.doScrollTo=function(c,d){d||Math.round(c*b.scrollratio.y);b.cursorfreezed=false;b.doScroll(c)};b.onscroll=function(){var c=(new Date).getTime();if(!b.lastcontentcheck||b.lastcontentcheck<c)if(b.lastcontentcheck=c+500,b.getContentSize().h!=b.page.h)b.onResize();if(!b.rail.drag){if(!b.cursorfreezed)b.scroll.y=Math.round(b.getScrollTop()*
-(1/b.scrollratio.y));b.noticeCursor()}};b.bind(b.docscroll,"scroll",b.onscroll);this.doZoomIn=function(c){if(!b.zoomactive){b.zoomactive=true;b.zoomrestore={style:{}};var d="position,top,left,zIndex,backgroundColor,marginTop,marginBottom,marginLeft,marginRight".split(","),f=b.win[0].style,g;for(g in d){var h=d[g];b.zoomrestore.style[h]=typeof f[h]!="undefined"?f[h]:""}b.zoomrestore.style.width=b.win.css("width");b.zoomrestore.style.height=b.win.css("height");b.zoomrestore.padding={w:b.win.outerWidth()-
-b.win.width(),h:b.win.outerHeight()-b.win.height()};if(b.isios4)b.zoomrestore.scrollTop=e(window).scrollTop(),e(window).scrollTop(0);b.win.css({position:b.isios4?"absolute":"fixed",top:0,left:0,"z-index":b.opt.zindex+100,margin:"0px"});d=b.win.css("backgroundColor");(d==""||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(d))&&b.win.css("backgroundColor","#fff");b.rail.css({"z-index":b.opt.zindex+110});b.zoom.css({"z-index":b.opt.zindex+112});b.zoom.css("backgroundPosition","0px -18px");b.resizeZoom();
-return b.cancelEvent(c)}};this.doZoomOut=function(c){if(b.zoomactive)return b.zoomactive=false,b.win.css("margin",""),b.win.css(b.zoomrestore.style),b.isios4&&e(window).scrollTop(b.zoomrestore.scrollTop),b.rail.css({"z-index":b.ispage?b.opt.zindex:b.opt.zindex+2}),b.zoom.css({"z-index":b.opt.zindex}),b.zoomrestore=false,b.zoom.css("backgroundPosition","0px 0px"),b.onResize(),b.cancelEvent(c)};this.doZoom=function(c){return b.zoomactive?b.doZoomOut(c):b.doZoomIn(c)};this.resizeZoom=function(){if(b.zoomactive){var c=
-b.getScrollTop();b.win.css({width:e(window).width()-b.zoomrestore.padding.w+"px",height:e(window).height()-b.zoomrestore.padding.h+"px"});b.setScrollTop(c);b.onResize()}};this.init()},u=function(e){var d=this;this.nc=e;this.lasttime=this.speedy=this.lasty=0;this.snapy=false;this.timer=this.demuly=0;this.time=function(){return(new Date).getTime()};this.reset=function(b){d.stop();d.lasttime=d.time();d.speedy=0;d.lasty=b};this.update=function(b){d.lasttime=d.time();var i=b-d.lasty,h=e.getScrollTop()+
-i;d.snapy=h<0||h>d.nc.page.maxh;d.speedy=i;d.lasty=b};this.stop=function(){if(d.timer)clearTimeout(d.timer),d.timer=0};this.doSnapy=function(b){b<0?d.nc.doScrollTo(0,true):b>d.nc.page.maxh&&d.nc.doScrollTo(d.nc.page.maxh,true)};this.doMomentum=function(){var b=d.lasttime,e=d.time();d.speedy=Math.min(200,d.speedy);if(d.speedy&&b&&e-b<=50&&d.speedy){var g=e-b;d.demuly=0;var j=function(){var b=Math.floor(d.nc.getScrollTop()-d.speedy*(1-d.demuly));d.demuly+=0.02;d.nc.setScrollTop(b);d.nc.showCursor(b);
-d.demuly<1?d.timer=setTimeout(j,g):(d.timer=0,d.nc.hideCursor(),d.doSnapy(b))};j()}else d.snapy&&d.doSnapy(d.nc.getScrollTop())}},j=jQuery.fn.scrollTop;e.cssHooks.scrollTop={get:function(g){var d=e.data(g,"__nicescroll")||false;return d&&d.ishwscroll?d.getScrollTop():j.call(g)},set:function(g,d){var b=e.data(g,"__nicescroll")||false;b&&b.ishwscroll?b.setScrollTop(parseInt(d)):j.call(g,d);return this}};jQuery.fn.scrollTop=function(g){if(typeof g=="undefined"){var d=e.data(this,"__nicescroll")||false;
-return d&&d.ishwscroll?d.getScrollTop():j.call(this)}else return this.each(function(){var b=e.data(this,"__nicescroll")||false;b&&b.ishwscroll?b.setScrollTop(parseInt(g)):j.call(e(this),g)})};var p=function(g){var d=this;this.length=0;this.name="nicescrollarray";this.each=function(b){for(var e=0;e<d.length;e++)b.call(d[e]);return d};this.show=function(){return d.each(function(){this.show()})};this.hide=function(){return d.each(function(){this.hide()})};this.onResize=function(){return d.each(function(){this.onResize()})};
-this.resize=function(){return d.each(function(){this.resize()})};this.remove=function(){return d.each(function(){this.remove()})};this.stop=function(){return d.each(function(){this.stop()})};this.push=function(b){d[d.length]=b;d.length++};this.eq=function(b){return d[b]};if(g)for(a=0;a<g.length;a++){var b=e.data(g[a],"__nicescroll")||false;b&&(this[this.length]=b,this.length++)}return this};jQuery.fn.getNiceScroll=function(g){return typeof g=="undefined"?this.length>0?new p(this):e.data(this,"__nicescroll")||
-false:e.data(this[g],"__nicescroll")||false};jQuery.extend(jQuery.expr[":"],{nicescroll:function(g){return e.data(g,"__nicescroll")||false}});e.fn.niceScroll=function(g,d){typeof g=="object"&&typeof d=="undefined"&&(d=g,g=false);var b=new p;typeof d=="undefined"&&(d={});if(g)d.doc=e(g),d.win=e(this);var i=!("doc"in d);this.each(function(){var g=e(this).data("__nicescroll")||false;if(!g)d.doc=i?e(this):d.doc,g=new v(d,e(this)),e(this).data("__nicescroll",g);b.push(g)});return b.length==1?b[0]:b}})(jQuery);
+(function(e){var l=false,n=false,q=5E3,r=2E3,s=function(){var e=document.getElementsByTagName("script"),e=e[e.length-1].src.split("?")[0];return e.split("/").length>0?e.split("/").slice(0,-1).join("/")+"/":""}(),v=function(f,d){var b=this;this.version="2.5.1";this.name="nicescroll";this.me=d;this.opt={doc:e("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,cursorminheight:20};if(f)for(var i in b.opt)typeof f[i]!="undefined"&&(b.opt[i]=f[i]);this.id=b.opt.doc[0].id||"";this.doc=b.opt.doc;this.ispage=/BODY|HTML/.test(b.doc[0].nodeName);this.haswrapper=b.opt.win!==false;this.win=b.opt.win||(this.ispage?e(window):this.doc);this.docscroll=this.ispage?e(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;this.scrollmom=false;do this.id="ascrail"+r++;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;this.events=[];this.saved={};var g=document.createElement("DIV");this.isopera="opera"in window;this.isieold=(this.isie="all"in document&&"attachEvent"in g&&!this.isopera)&&!("msInterpolationMode"in g.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 g.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":g.style.webkitTransform!==void 0?"webkitTransform":g.style.MozTransform!==void 0?"MozTransform":false)&&g.style[this.trstyle]===void 0)this.trstyle=false;if(this.hastransform=this.trstyle!=
+false)g.style[this.trstyle]="translate3d(1px,2px,3px)",this.hastranslate3d=/translate3d/.test(g.style[this.trstyle]);this.transitionstyle=false;this.prefixstyle="";this.transitionend=false;var o="transition,webkitTransition,MozTransition,OTransition,msTransition,KhtmlTransition".split(","),t=",-webkit-,-moz-,-o-,-ms-,-khtml-".split(","),j="transitionEnd,webkitTransitionEnd,transitionend,oTransitionEnd,msTransitionEnd,KhtmlTransitionEnd".split(",");for(i=0;i<o.length;i++)if(o[i]in g.style){this.transitionstyle=
+o[i];this.prefixstyle=t[i];this.transitionend=j[i];break}this.hastransition=this.transitionstyle}else this.transitionend=this.hastransition=this.transitionstyle=this.hastranslate3d=this.hastransform=this.trstyle=false;this.cursorgrabvalue="";if(b.opt.grabcursorenabled&&b.opt.touchbehavior)this.cursorgrabvalue=function(){if(!b.isie||b.isie9)for(var c=["grab","-moz-grab","-webkit-grab"],h=0;h<c.length;h++){var d=c[h];g.style.cursor=d;if(g.style.cursor==d)return d}return"url(http://www.google.com/intl/en_ALL/mapfiles/openhand.cur),n-resize"}();
+g=null;this.ishwscroll=b.hastransform&&b.opt.hwacceleration&&b.haswrapper;this.scrollTop=function(c){return c===void 0?b.getScrollTop():b.setScrollTop(c)};this.ishwscroll?(b.doc.translate={x:0,y:0},this.getScrollTop=function(){return b.doc.translate.y},this.notifyScrollEvent=document.createEvent?function(b){var h=document.createEvent("UIEvents");h.initUIEvent("scroll",false,true,window,1);b.dispatchEvent(h)}:document.fireEvent?function(b){var h=document.createEventObject();b.fireEvent("onscroll");
+h.cancelBubble=true}:function(){},this.setScrollTop=this.hastranslate3d?function(c,h){b.doc.css(b.trstyle,"translate3d(0px,"+c*-1+"px,0px)");b.doc.translate.y=c;h||b.notifyScrollEvent(b.docscroll[0])}:function(c,h){b.doc.css(b.trstyle,"translate(0px,"+c*-1+"px)");b.doc.translate.y=c;h||b.notifyScrollEvent(b.docscroll[0])}):(this.getScrollTop=function(){return b.docscroll.scrollTop()},this.setScrollTop=function(c){return b.docscroll.scrollTop(c)});this.getTarget=function(b){return!b?false:b.target?
+b.target:b.srcElement?b.srcElement:false};this.hasParent=function(b,h){if(!b)return false;for(var d=b.target||b.srcElement||b||false;d&&d.id!=h;)d=d.parentNode||false;return d!==false};this.updateScrollBar=function(c){if(b.ishwscroll)b.rail.css({height:b.win.innerHeight()});else{var d=b.win.offset();d.top+=2;var e=(b.win.outerWidth()-b.win.innerWidth())/2;d.left+=b.win.innerWidth()+e-b.rail.width-1;b.rail.css({position:"absolute",top:d.top,left:d.left,height:c?c.h:b.win.innerHeight()});b.zoom&&b.zoom.css({position:"absolute",
+top:d.top+1,left:d.left-20})}};var k=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||false,m=window.cancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||false;b.hasanimationframe=k;b.hascancelanimationframe=m;b.hasanimationframe?b.hascancelanimationframe||
+(m=function(){b.cancelAnimationFrame=true}):(k=function(b){return setTimeout(b,1E3/60)},m=clearInterval);this.init=function(){b.saved.css=[];b.ispage&&b.saved.css.push([b.doc,"overflow-y",b.doc.css("overflow-y")]);b.ispage||b.saved.css.push([b.docscroll,"overflow-y",b.docscroll.css("overflow-y")]);b.ispage&&b.isie7&&b.saved.css.push([e("html"),"overflow-y",e("html").css("overflow-y")]);if(!b.ispage||!b.cantouch&&!b.isieold){b.ispage?b.doc.css({"overflow-y":"hidden"}):b.docscroll.css({"overflow-y":"hidden"});
+b.ispage&&b.isie7&&e("html").css({"overflow-y":"hidden"});var c=e(document.createElement("div"));c.css({position:"relative",top:0,"float":"right",width:b.opt.cursorwidth,height:"0px","background-color":b.opt.cursorcolor,border:b.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":b.opt.cursorborderradius,"-moz-border-radius":b.opt.cursorborderradius,"border-radius":b.opt.cursorborderradius});c.hborder=parseFloat(c.outerHeight()-c.innerHeight());b.cursor=c;var d=e(document.createElement("div"));
+d.attr("id",b.id);d.width=3+Math.max(parseFloat(b.opt.cursorwidth),c.outerWidth());d.css({"padding-left":"0px","padding-right":"1px",width:d.width+"px",zIndex:b.ispage?b.opt.zindex:b.opt.zindex+2,background:b.opt.background});d.append(c);b.rail=d;c=false;if(b.opt.boxzoom&&!b.ispage&&!b.isieold)c=document.createElement("div"),b.bind(c,"click",b.doZoom),b.zoom=e(c),b.zoom.css({cursor:"pointer","z-index":b.opt.zindex,backgroundImage:"url("+s+"zoomico.png)",height:18,width:18,backgroundPosition:"0px 0px"}),
+b.opt.dblclickzoom&&b.bind(b.win,"dblclick",b.doZoom),b.cantouch&&b.opt.gesturezoom&&b.bind(b.win,"gestureend",function(c){c.scale>1.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+4}),b.win.append(b.zoom)),d.css({position:"absolute",
+top:0,right:0}),b.win.append(d)):(b.updateScrollBar(),e("body").append(d),b.zoom&&e("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&&e(window).resize(b.resizeZoom);
+b.istextarea&&b.win.mouseup(b.onResize);b.onResize();b.cantouch||b.opt.touchbehavior?(b.scrollmom={y:new u(b)},b.onmousedown=function(c){if(!b.locked&&(b.cancelScroll(),b.rail.drag={x:c.pageX,y:c.pageY,sx:b.scroll.x,sy:b.scroll.y,st:b.getScrollTop()},b.hasmoving=false,b.scrollmom.y.reset(c.pageY),!b.cantouch))return b.cancelEvent(c)},b.onmouseup=function(c){if(b.rail.drag&&(b.scrollmom.y.doMomentum(),b.rail.drag=false,b.hasmoving))return b.hasmoving=false,b.cancelEvent(c)},b.onmousemove=function(c){if(b.rail.drag){b.hasmoving=
+true;var d=c.pageY-b.rail.drag.y;b.scrollmom.y.update(c.pageY);b.showCursor(b.rail.drag.st-d);b.prepareTransition&&b.prepareTransition(0);b.setScrollTop(b.rail.drag.st-d);return b.cancelEvent(c)}},b.cursorgrabvalue&&(b.saved.css.push([b.win,"cursor",b.win.css("cursor")]),b.win.css({cursor:b.cursorgrabvalue}))):(b.onmousedown=function(c){if(b.locked)return b.cancelEvent(c);b.cancelScroll();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.hasmoving=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:q++}),
+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){n=b.getTarget(c).id||true;b.hasmousefocus=true;b.noticeCursor()}),b.win.mouseleave(function(){n=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&&!n){d=c.keyCode;if(b.locked&&d!=27)return b.cancelEvent(c);var h=true;switch(d){case 38:case 63233:b.doScrollBy(72,true);h=false;break;case 40:case 63235:b.doScrollBy(-72,true);h=false;break;case 33:case 63276:b.doScrollBy(b.view.h,true);h=false;break;case 34:case 63277:b.doScrollBy(-b.view.h,true);h=false;break;case 36:case 63273:b.doScrollTo(0,true);h=false;break;case 35:case 63275:b.doScrollTo(b.page.maxh,true);h=false;break;case 27:b.zoomactive&&(b.doZoom(),h=false)}if(!h)return b.cancelEvent(c)}};
+b.bind(document,b.isopera?"keypress":"keydown",b.onkeypress)}if(this.doc[0].nodeName=="IFRAME"){var f=function(){var c="contentDocument"in this?this.contentDocument:this.contentWindow.document;if(b.isiframe)b.docscroll=e(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&&b.saved.css.push([e(c).find("html"),"overflow-y",e(c).find("html").css("overflow-y")]);b.saved.css.push([e(c.body),"overflow-y",e(c.body).css("overflow-y")]);b.isie7&&e(c).find("html").css({"overflow-y":"hidden"});e(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&&(b.saved.css.push([e(c),"cursor",e(c).css("cursor")]),e(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(){f.call(b.doc[0],
+false)},500);this.doc.load(f)}};this.showCursor=function(c){if(b.cursortimeout)clearTimeout(b.cursortimeout),b.cursortimeout=0;if(b.rail){b.autohidedom&&b.autohidedom.stop().css({opacity:b.opt.cursoropacitymax});if(typeof c!="undefined")b.scroll.y=Math.round(c*1/b.scrollratio.y);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.resize=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();
+b.page.maxh=b.page.h-b.view.h;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.cursorheight=Math.max(b.opt.cursorminheight,b.cursorheight);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();return b};this._bind=function(c,d,e,f){b.events.push({e:c,n:d,f:e});c.addEventListener?c.addEventListener(d,e,f||false):c.attachEvent?c.attachEvent("on"+d,e):c["on"+d]=e};this.bind=function(c,d,e,f){var g=c.length&&"selector"in c?c[0]:c;g.addEventListener?(b.cantouch&&/mouseup|mousedown|mousemove/.test(d)&&b._bind(g,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),b._bind(g,d,e,f||false),d=="mousewheel"&&b._bind(g,"DOMMouseScroll",e,f||false),b.cantouch&&d=="mouseup"&&b._bind(g,"touchcancel",e,f||false)):b._bind(g,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})};this._unbind=function(b,d,e){b.removeEventListener?
+b.removeEventListener(d,e,false):b.detachEvent?b.detachEvent("on"+d,e):b["on"+d]=false};this.unbindAll=function(){for(var c=0;c<b.events.length;c++){var d=b.events[c];b._unbind(d.e,d.n,d.f)}};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");return b};this.hide=function(){b.visibility=false;b.rail.css("display","none");return b};this.remove=function(){b.doZoomOut();b.unbindAll();b.events=[];b.rail.remove();b.zoom&&b.zoom.remove();b.cursor=false;b.rail=false;b.zoom=false;for(var c=0;c<b.saved.css.length;c++){var d=b.saved.css[c];d[0].css(d[1],typeof d[2]=="undefined"?"":d[2])}b.saved=false;b.me.data("__nicescroll","");return b};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;if(d=c.detail?c.detail*-1:c.wheelDelta/40)b.scrollmom&&b.scrollmom.y.stop(),b.doScrollBy(d*b.opt.mousescrollstep,true);return b.cancelEvent(c)};this.stop=function(){b.cancelScroll();b.scrollmon&&b.scrollmon.stop();b.cursorfreezed=false;b.scroll.y=Math.round(b.getScrollTop()*(1/b.scrollratio.y));b.noticeCursor();return b};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)return false;b.timer=setTimeout(function(){var c=b.getScrollTop(),c=Math.abs(c-b.newscrolly);b.prepareTransition(c);b.timer=setTimeout(function(){b.setScrollTop(b.newscrolly);b.timer=0},15)},b.opt.scrollspeed);b.noticeCursor()},this.cancelScroll=function(){var c=b.getScrollTop();b.prepareTransition(0);
+b.setScrollTop(c);b.noticeCursor();return b}):(this.doScroll=function(c){function d(){if(b.cancelAnimationFrame)return true;g=(new Date).getTime();if(g<i)return b.timer=k(d)||1;i=Math.floor((new Date).getTime()+b.opt.scrollspeed/2);g=0;var c=b.getScrollTop();if(b.newspeedy)if(c+=b.newspeedy.v,b.newspeedy.v>0){if(c>=b.newspeedy.x)b.newspeedy=false}else{if(c<=b.newspeedy.x)b.newspeedy=false}else c=b.newscrolly-b.getScrollTop(),c=(c=c>0?Math.ceil(c*f):Math.floor(c*f))?b.getScrollTop()+c:b.newscrolly;
+b.setScrollTop(c);c==b.newscrolly?(b.timer=0,b.cursorfreezed=false):b.timer=k(d)||1}b.newscrolly=c;var e=c-b.getScrollTop();b.newspeedy=e*e>100?{x:c-Math.round(e/6),v:Math.round(e/6*5/8+0.5)}:false;if(!b.timer){var f=0.25,g=0,i=0;b.cancelAnimationFrame=false;b.timer=k(d)||1;b.noticeCursor()}},this.cancelScroll=function(){b.timer&&m(b.timer);b.timer=0;return b});this.doScrollBy=function(c,d){var e=0,e=d?b.timer?b.newscrolly-c:b.getScrollTop()-c:Math.floor((b.scroll.y-c)*b.scrollratio.y);if(e<0)e=0;
+else if(e>b.page.maxh)e=b.page.maxh;b.cursorfreezed=false;b.doScroll(e)};this.doScrollTo=function(c,d){d||Math.round(c*b.scrollratio.y);b.cursorfreezed=false;b.doScroll(c)};b.onscroll=function(){var c=(new Date).getTime();if(!b.lastcontentcheck||b.lastcontentcheck<c)if(b.lastcontentcheck=c+500,b.getContentSize().h!=b.page.h)b.onResize();if(!b.rail.drag){if(!b.cursorfreezed)b.scroll.y=Math.round(b.getScrollTop()*(1/b.scrollratio.y));b.noticeCursor()}};b.bind(b.docscroll,"scroll",b.onscroll);this.doZoomIn=
+function(c){if(!b.zoomactive){b.zoomactive=true;b.zoomrestore={style:{}};var d="position,top,left,zIndex,backgroundColor,marginTop,marginBottom,marginLeft,marginRight".split(","),f=b.win[0].style,g;for(g in d){var i=d[g];b.zoomrestore.style[i]=typeof f[i]!="undefined"?f[i]:""}b.zoomrestore.style.width=b.win.css("width");b.zoomrestore.style.height=b.win.css("height");b.zoomrestore.padding={w:b.win.outerWidth()-b.win.width(),h:b.win.outerHeight()-b.win.height()};if(b.isios4)b.zoomrestore.scrollTop=
+e(window).scrollTop(),e(window).scrollTop(0);b.win.css({position:b.isios4?"absolute":"fixed",top:0,left:0,"z-index":b.opt.zindex+100,margin:"0px"});d=b.win.css("backgroundColor");(d==""||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(d))&&b.win.css("backgroundColor","#fff");b.rail.css({"z-index":b.opt.zindex+110});b.zoom.css({"z-index":b.opt.zindex+112});b.zoom.css("backgroundPosition","0px -18px");b.resizeZoom();return b.cancelEvent(c)}};this.doZoomOut=function(c){if(b.zoomactive)return b.zoomactive=
+false,b.win.css("margin",""),b.win.css(b.zoomrestore.style),b.isios4&&e(window).scrollTop(b.zoomrestore.scrollTop),b.rail.css({"z-index":b.ispage?b.opt.zindex:b.opt.zindex+2}),b.zoom.css({"z-index":b.opt.zindex}),b.zoomrestore=false,b.zoom.css("backgroundPosition","0px 0px"),b.onResize(),b.cancelEvent(c)};this.doZoom=function(c){return b.zoomactive?b.doZoomOut(c):b.doZoomIn(c)};this.resizeZoom=function(){if(b.zoomactive){var c=b.getScrollTop();b.win.css({width:e(window).width()-b.zoomrestore.padding.w+
+"px",height:e(window).height()-b.zoomrestore.padding.h+"px"});b.setScrollTop(c);b.onResize()}};this.init()},u=function(e){var d=this;this.nc=e;this.lasttime=this.speedy=this.lasty=0;this.snapy=false;this.timer=this.demuly=0;this.time=function(){return(new Date).getTime()};this.reset=function(b){d.stop();d.lasttime=d.time();d.speedy=0;d.lasty=b};this.update=function(b){d.lasttime=d.time();var i=b-d.lasty,g=e.getScrollTop()+i;d.snapy=g<0||g>d.nc.page.maxh;d.speedy=i;d.lasty=b};this.stop=function(){if(d.timer)clearTimeout(d.timer),
+d.timer=0};this.doSnapy=function(b){b<0?d.nc.doScrollTo(0,true):b>d.nc.page.maxh&&d.nc.doScrollTo(d.nc.page.maxh,true)};this.doMomentum=function(){var b=d.lasttime,e=d.time();d.speedy=Math.min(200,d.speedy);if(d.speedy&&b&&e-b<=50&&d.speedy){var f=e-b;d.demuly=0;var j=function(){var b=Math.floor(d.nc.getScrollTop()-d.speedy*(1-d.demuly));d.demuly+=0.02;d.nc.setScrollTop(b);d.nc.showCursor(b);d.demuly<1?d.timer=setTimeout(j,f):(d.timer=0,d.nc.hideCursor(),d.doSnapy(b))};j()}else d.snapy&&d.doSnapy(d.nc.getScrollTop())}},
+j=jQuery.fn.scrollTop;e.cssHooks.scrollTop={get:function(f){var d=e.data(f,"__nicescroll")||false;return d&&d.ishwscroll?d.getScrollTop():j.call(f)},set:function(f,d){var b=e.data(f,"__nicescroll")||false;b&&b.ishwscroll?b.setScrollTop(parseInt(d)):j.call(f,d);return this}};jQuery.fn.scrollTop=function(f){if(typeof f=="undefined"){var d=e.data(this[0],"__nicescroll")||false;return d&&d.ishwscroll?d.getScrollTop():j.call(this)}else return this.each(function(){var b=e.data(this,"__nicescroll")||false;
+b&&b.ishwscroll?b.setScrollTop(parseInt(f)):j.call(e(this),f)})};var p=function(f){var d=this;this.length=0;this.name="nicescrollarray";this.each=function(b){for(var e=0;e<d.length;e++)b.call(d[e]);return d};this.show=function(){return d.each(function(){this.show()})};this.hide=function(){return d.each(function(){this.hide()})};this.onResize=function(){return d.each(function(){this.onResize()})};this.resize=function(){return d.each(function(){this.resize()})};this.remove=function(){return d.each(function(){this.remove()})};
+this.stop=function(){return d.each(function(){this.stop()})};this.push=function(b){d[d.length]=b;d.length++};this.eq=function(b){return d[b]};if(f)for(a=0;a<f.length;a++){var b=e.data(f[a],"__nicescroll")||false;b&&(this[this.length]=b,this.length++)}return this};jQuery.fn.getNiceScroll=function(f){return typeof f=="undefined"?new p(this):e.data(this[f],"__nicescroll")||false};jQuery.extend(jQuery.expr[":"],{nicescroll:function(f){return e.data(f,"__nicescroll")||false}});e.fn.niceScroll=function(f,
+d){typeof f=="object"&&typeof d=="undefined"&&(d=f,f=false);var b=new p;typeof d=="undefined"&&(d={});if(f)d.doc=e(f),d.win=e(this);var i=!("doc"in d);this.each(function(){var f=e(this).data("__nicescroll")||false;if(!f)d.doc=i?e(this):d.doc,f=new v(d,e(this)),e(this).data("__nicescroll",f);b.push(f)});return b.length==1?b[0]:b}})(jQuery);

+ 33 - 32
jquery.nicescroll.js

@@ -1,5 +1,5 @@
 /* jquery.nicescroll
--- version 2.5.0
+-- version 2.5.1
 -- copyright 2011 InuYaksa*2011
 -- licensed under the MIT
 --
@@ -30,7 +30,7 @@
 
     var self = this;
 
-    this.version = '2.5.0';
+    this.version = '2.5.1';
     this.name = 'nicescroll';
     
     this.me = me;
@@ -62,13 +62,13 @@
     
     if (myopt||false) {
       for(var a in self.opt) {
-        if (myopt[a]!==undefined) self.opt[a] = myopt[a];
+        if (typeof myopt[a] != "undefined") self.opt[a] = myopt[a];
       }
     }
     
     this.id = self.opt.doc[0].id||'';
     this.doc = self.opt.doc;
-    this.ispage = (self.doc[0].nodeName=='BODY'||self.doc[0].nodeName=='HTML');  
+    this.ispage = /BODY|HTML/.test(self.doc[0].nodeName);  
     this.haswrapper = (self.opt.win!==false);
     this.win = self.opt.win||(this.ispage?$(window):this.doc);
     this.docscroll = this.ispage?$(window):this.win;
@@ -205,37 +205,36 @@
       this.getScrollTop = function() {
         return self.doc.translate.y;
       };
+      
+      if (document.createEvent) {
+        this.notifyScrollEvent = function(el) {
+          var e = document.createEvent("UIEvents");
+          e.initUIEvent("scroll", false, true, window, 1);
+          el.dispatchEvent(e);
+        };
+      }
+      else if (document.fireEvent) {
+        this.notifyScrollEvent = function(el) {
+          var e = document.createEventObject();
+          el.fireEvent("onscroll");
+          e.cancelBubble = true; 
+        };
+      }
+      else {
+        this.notifyScrollEvent = function(el) {}; //NOPE
+      }
+      
       if (this.hastranslate3d) {
         this.setScrollTop = function(val,silent) {
           self.doc.css(self.trstyle,"translate3d(0px,"+(val*-1)+"px,0px)");
           self.doc.translate.y = val;
-          if (!silent) {
-            if (document.createEvent) {
-              var e = document.createEvent("UIEvents");
-              e.initUIEvent("scroll", false, true, window, 1);
-              self.docscroll[0].dispatchEvent(e);
-            } else {
-              var e = document.createEventObject();
-              self.docscroll[0].fireEvent("onscroll");
-              e.cancelBubble = true; 
-            }
-          }
+          if (!silent) self.notifyScrollEvent(self.docscroll[0]);
         };
       } else {
         this.setScrollTop = function(val,silent) {
           self.doc.css(self.trstyle,"translate(0px,"+(val*-1)+"px)");
           self.doc.translate.y = val;
-          if (!silent) {
-            if (document.createEvent) {
-              var e = document.createEvent("UIEvents");
-              e.initUIEvent("scroll", false, true, window, 1);
-              self.docscroll[0].dispatchEvent(e);
-            } else {
-              var e = document.createEventObject();
-              self.docscroll[0].fireEvent("onscroll");
-              e.cancelBubble = true; 
-            }
-          }
+          if (!silent) self.notifyScrollEvent(self.docscroll[0]);          
         };
       }
     } else {
@@ -797,7 +796,7 @@
     };
    
     this.bind = function(dom,name,fn,bubble) {  // touch-oriented & fixing jquery bind
-      var el = (dom.length) ? dom[0] : dom;
+      var el = (dom.length&&("selector" in dom)) ? dom[0] : dom;
       if (el.addEventListener) {
         if (self.cantouch && /mouseup|mousedown|mousemove/.test(name)) {  // touch device support
           var tt = (name=='mousedown')?'touchstart':(name=='mouseup')?'touchend':'touchmove';
@@ -940,6 +939,7 @@
       };
       
 //      self.bind(self.doc,'transitionend',function(e){console.log(e)},false); TEST!! Later or soon I use it! (I hope so)
+
     } else {
       this.doScroll = function(y) {
         self.newscrolly = y;
@@ -947,7 +947,7 @@
         if ((df*df)>100) {
           self.newspeedy = {
             x:y-Math.round(df/6),
-            v:Math.round(df/6*5/8)+1
+            v:Math.round((df/6*5/8)+0.5)
           };
         } else {
           self.newspeedy = false;
@@ -973,12 +973,13 @@
           } else {
             var gp = self.newscrolly - self.getScrollTop();
             var df = (gp>0) ? Math.ceil(gp*rt) : Math.floor(gp*rt);
-            var sc = self.getScrollTop()+df;
+            var sc = (df) ? self.getScrollTop()+df : self.newscrolly;
           }
           self.setScrollTop(sc);
 //          if (!self.cursorfreezed) self.showCursor(sc);
-          if (sc == self.newscrolly) {
+          if (sc == self.newscrolly) {            
 //            clearAnimationFrame(self.timer);
+//            console.log('stop');
             self.timer = 0;        
             self.cursorfreezed = false;
           } else {
@@ -1224,7 +1225,7 @@
  
   jQuery.fn.scrollTop = function(value) {    
     if (typeof value == "undefined") {
-      var nice = $.data(this,'__nicescroll')||false;
+      var nice = $.data(this[0],'__nicescroll')||false;
       return (nice&&nice.ishwscroll) ? nice.getScrollTop() : _scrollTop.call(this);
     } else {
       return this.each(function() {     
@@ -1304,7 +1305,7 @@
   
   jQuery.fn.getNiceScroll = function(index) {
     if (typeof index == "undefined") {
-      return (this.length>0) ? new NiceScrollArray(this) : $.data(this,'__nicescroll')||false;
+      return new NiceScrollArray(this);
     } else {
       var nice = $.data(this[index],'__nicescroll')||false;
       return nice;

+ 49 - 49
jquery.nicescroll.min.js

@@ -1,5 +1,5 @@
 /* jquery.nicescroll
--- version 2.5.0
+-- version 2.5.1
 -- copyright 2011 InuYaksa*2011
 -- licensed under the MIT
 --
@@ -7,51 +7,51 @@
 -- https://github.com/inuyaksa/jquery.nicescroll
 --
 */
-(function(e){var l=false,n=false,q=5E3,r=2E3,s=function(){var e=document.getElementsByTagName("script"),e=e[e.length-1].src.split("?")[0];return e.split("/").length>0?e.split("/").slice(0,-1).join("/")+"/":""}(),v=function(g,d){var b=this;this.version="2.5.0";this.name="nicescroll";this.me=d;this.opt={doc:e("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,cursorminheight:20};if(g)for(var i in b.opt)g[i]!==void 0&&(b.opt[i]=g[i]);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?e(window):this.doc);this.docscroll=this.ispage?e(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;this.scrollmom=false;do this.id="ascrail"+r++;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;this.events=[];this.saved={};var h=document.createElement("DIV");this.isopera="opera"in window;this.isieold=(this.isie="all"in document&&"attachEvent"in h&&!this.isopera)&&!("msInterpolationMode"in h.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 h.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":h.style.webkitTransform!==void 0?"webkitTransform":h.style.MozTransform!==void 0?"MozTransform":false)&&h.style[this.trstyle]===void 0)this.trstyle=false;if(this.hastransform=this.trstyle!=
-false)h.style[this.trstyle]="translate3d(1px,2px,3px)",this.hastranslate3d=/translate3d/.test(h.style[this.trstyle]);this.transitionstyle=false;this.prefixstyle="";this.transitionend=false;var o="transition,webkitTransition,MozTransition,OTransition,msTransition,KhtmlTransition".split(","),t=",-webkit-,-moz-,-o-,-ms-,-khtml-".split(","),j="transitionEnd,webkitTransitionEnd,transitionend,oTransitionEnd,msTransitionEnd,KhtmlTransitionEnd".split(",");for(i=0;i<o.length;i++)if(o[i]in h.style){this.transitionstyle=
-o[i];this.prefixstyle=t[i];this.transitionend=j[i];break}this.hastransition=this.transitionstyle}else this.transitionend=this.hastransition=this.transitionstyle=this.hastranslate3d=this.hastransform=this.trstyle=false;this.cursorgrabvalue="";if(b.opt.grabcursorenabled&&b.opt.touchbehavior)this.cursorgrabvalue=function(){if(!b.isie||b.isie9)for(var c=["grab","-moz-grab","-webkit-grab"],d=0;d<c.length;d++){var f=c[d];h.style.cursor=f;if(h.style.cursor==f)return f}return"url(http://www.google.com/intl/en_ALL/mapfiles/openhand.cur),n-resize"}();
-h=null;this.ishwscroll=b.hastransform&&b.opt.hwacceleration&&b.haswrapper;this.scrollTop=function(c){return c===void 0?b.getScrollTop():b.setScrollTop(c)};this.ishwscroll?(b.doc.translate={x:0,y:0},this.getScrollTop=function(){return b.doc.translate.y},this.setScrollTop=this.hastranslate3d?function(c,d){b.doc.css(b.trstyle,"translate3d(0px,"+c*-1+"px,0px)");b.doc.translate.y=c;if(!d)if(document.createEvent){var f=document.createEvent("UIEvents");f.initUIEvent("scroll",false,true,window,1);b.docscroll[0].dispatchEvent(f)}else f=
-document.createEventObject(),b.docscroll[0].fireEvent("onscroll"),f.cancelBubble=true}:function(c,d){b.doc.css(b.trstyle,"translate(0px,"+c*-1+"px)");b.doc.translate.y=c;if(!d)if(document.createEvent){var f=document.createEvent("UIEvents");f.initUIEvent("scroll",false,true,window,1);b.docscroll[0].dispatchEvent(f)}else f=document.createEventObject(),b.docscroll[0].fireEvent("onscroll"),f.cancelBubble=true}):(this.getScrollTop=function(){return b.docscroll.scrollTop()},this.setScrollTop=function(c){return b.docscroll.scrollTop(c)});
-this.getTarget=function(b){return!b?false:b.target?b.target:b.srcElement?b.srcElement:false};this.hasParent=function(b,d){if(!b)return false;for(var f=b.target||b.srcElement||b||false;f&&f.id!=d;)f=f.parentNode||false;return f!==false};this.updateScrollBar=function(c){if(b.ishwscroll)b.rail.css({height:b.win.innerHeight()});else{var d=b.win.offset();d.top+=2;var f=(b.win.outerWidth()-b.win.innerWidth())/2;d.left+=b.win.innerWidth()+f-b.rail.width-1;b.rail.css({position:"absolute",top:d.top,left:d.left,
-height:c?c.h:b.win.innerHeight()});b.zoom&&b.zoom.css({position:"absolute",top:d.top+1,left:d.left-20})}};var k=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||false,m=window.cancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||false;b.hasanimationframe=k;
-b.hascancelanimationframe=m;b.hasanimationframe?b.hascancelanimationframe||(m=function(){b.cancelAnimationFrame=true}):(k=function(b){return setTimeout(b,1E3/60)},m=clearInterval);this.init=function(){b.saved.css=[];b.ispage&&b.saved.css.push([b.doc,"overflow-y",b.doc.css("overflow-y")]);b.ispage||b.saved.css.push([b.docscroll,"overflow-y",b.docscroll.css("overflow-y")]);b.ispage&&b.isie7&&b.saved.css.push([e("html"),"overflow-y",e("html").css("overflow-y")]);if(!b.ispage||!b.cantouch&&!b.isieold){b.ispage?
-b.doc.css({"overflow-y":"hidden"}):b.docscroll.css({"overflow-y":"hidden"});b.ispage&&b.isie7&&e("html").css({"overflow-y":"hidden"});var c=e(document.createElement("div"));c.css({position:"relative",top:0,"float":"right",width:b.opt.cursorwidth,height:"0px","background-color":b.opt.cursorcolor,border:b.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":b.opt.cursorborderradius,"-moz-border-radius":b.opt.cursorborderradius,"border-radius":b.opt.cursorborderradius});c.hborder=
-parseFloat(c.outerHeight()-c.innerHeight());b.cursor=c;var d=e(document.createElement("div"));d.attr("id",b.id);d.width=3+Math.max(parseFloat(b.opt.cursorwidth),c.outerWidth());d.css({"padding-left":"0px","padding-right":"1px",width:d.width+"px",zIndex:b.ispage?b.opt.zindex:b.opt.zindex+2,background:b.opt.background});d.append(c);b.rail=d;c=false;if(b.opt.boxzoom&&!b.ispage&&!b.isieold)c=document.createElement("div"),b.bind(c,"click",b.doZoom),b.zoom=e(c),b.zoom.css({cursor:"pointer","z-index":b.opt.zindex,
-backgroundImage:"url("+s+"zoomico.png)",height:18,width:18,backgroundPosition:"0px 0px"}),b.opt.dblclickzoom&&b.bind(b.win,"dblclick",b.doZoom),b.cantouch&&b.opt.gesturezoom&&b.bind(b.win,"gestureend",function(c){c.scale>1.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+4}),b.win.append(b.zoom)),d.css({position:"absolute",top:0,right:0}),b.win.append(d)):(b.updateScrollBar(),e("body").append(d),b.zoom&&e("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&&e(window).resize(b.resizeZoom);b.istextarea&&b.win.mouseup(b.onResize);b.onResize();b.cantouch||b.opt.touchbehavior?(b.scrollmom={y:new u(b)},b.onmousedown=function(c){if(!b.locked&&(b.cancelScroll(),b.rail.drag={x:c.pageX,y:c.pageY,sx:b.scroll.x,sy:b.scroll.y,st:b.getScrollTop()},b.hasmoving=false,b.scrollmom.y.reset(c.pageY),!b.cantouch))return b.cancelEvent(c)},b.onmouseup=function(c){if(b.rail.drag&&(b.scrollmom.y.doMomentum(),b.rail.drag=
-false,b.hasmoving))return b.hasmoving=false,b.cancelEvent(c)},b.onmousemove=function(c){if(b.rail.drag){b.hasmoving=true;var d=c.pageY-b.rail.drag.y;b.scrollmom.y.update(c.pageY);b.showCursor(b.rail.drag.st-d);b.prepareTransition&&b.prepareTransition(0);b.setScrollTop(b.rail.drag.st-d);return b.cancelEvent(c)}},b.cursorgrabvalue&&(b.saved.css.push([b.win,"cursor",b.win.css("cursor")]),b.win.css({cursor:b.cursorgrabvalue}))):(b.onmousedown=function(c){if(b.locked)return b.cancelEvent(c);b.cancelScroll();
-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.hasmoving=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:q++}),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){n=b.getTarget(c).id||true;b.hasmousefocus=true;b.noticeCursor()}),b.win.mouseleave(function(){n=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&&!n){d=c.keyCode;if(b.locked&&d!=27)return b.cancelEvent(c);var f=true;switch(d){case 38:case 63233:b.doScrollBy(72,true);f=false;break;case 40:case 63235:b.doScrollBy(-72,true);f=false;break;case 33:case 63276:b.doScrollBy(b.view.h,true);f=false;break;case 34:case 63277:b.doScrollBy(-b.view.h,true);f=false;break;case 36:case 63273:b.doScrollTo(0,
-true);f=false;break;case 35:case 63275:b.doScrollTo(b.page.maxh,true);f=false;break;case 27:b.zoomactive&&(b.doZoom(),f=false)}if(!f)return b.cancelEvent(c)}};b.bind(document,b.isopera?"keypress":"keydown",b.onkeypress)}if(this.doc[0].nodeName=="IFRAME"){var f=function(){var c="contentDocument"in this?this.contentDocument:this.contentWindow.document;if(b.isiframe)b.docscroll=e(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&&b.saved.css.push([e(c).find("html"),"overflow-y",e(c).find("html").css("overflow-y")]);b.saved.css.push([e(c.body),"overflow-y",e(c.body).css("overflow-y")]);b.isie7&&e(c).find("html").css({"overflow-y":"hidden"});e(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&&(b.saved.css.push([e(c),"cursor",e(c).css("cursor")]),e(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(){f.call(b.doc[0],false)},500);this.doc.load(f)}};this.showCursor=function(c){if(b.cursortimeout)clearTimeout(b.cursortimeout),b.cursortimeout=0;if(b.rail){b.autohidedom&&b.autohidedom.stop().css({opacity:b.opt.cursoropacitymax});if(typeof c!="undefined")b.scroll.y=Math.round(c*1/b.scrollratio.y);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.resize=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();b.page.maxh=b.page.h-b.view.h;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.cursorheight=Math.max(b.opt.cursorminheight,b.cursorheight);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();return b};this._bind=function(c,d,f,e){b.events.push({e:c,n:d,f:f});c.addEventListener?c.addEventListener(d,f,e||false):c.attachEvent?c.attachEvent("on"+d,f):c["on"+d]=f};this.bind=function(c,
-d,f,e){var g=c.length?c[0]:c;g.addEventListener?(b.cantouch&&/mouseup|mousedown|mousemove/.test(d)&&b._bind(g,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;f.call(this,c)}},e||false),b._bind(g,d,f,e||false),d=="mousewheel"&&b._bind(g,"DOMMouseScroll",f,e||false),b.cantouch&&d=="mouseup"&&b._bind(g,"touchcancel",f,e||false)):b._bind(g,d,function(c){if(c&&!("pageY"in c)&&"screenY"in c)c.pageX=c.screenX,
-c.pageY=c.screenY;return f.call(g,c)===false||e===false?b.cancelEvent(c):true})};this._unbind=function(b,d,f){b.removeEventListener?b.removeEventListener(d,f,false):b.detachEvent?b.detachEvent("on"+d,f):b["on"+d]=false};this.unbindAll=function(){for(var c=0;c<b.events.length;c++){var d=b.events[c];b._unbind(d.e,d.n,d.f)}};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");return b};this.hide=function(){b.visibility=false;b.rail.css("display","none");return b};this.remove=function(){b.doZoomOut();b.unbindAll();b.events=[];b.rail.remove();b.zoom&&b.zoom.remove();b.cursor=false;b.rail=false;b.zoom=false;for(var c=0;c<b.saved.css.length;c++){var d=b.saved.css[c];d[0].css(d[1],typeof d[2]=="undefined"?"":d[2])}b.saved=false;b.me.data("__nicescroll",
-"");return b};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;if(d=c.detail?c.detail*-1:c.wheelDelta/40)b.scrollmom&&b.scrollmom.y.stop(),b.doScrollBy(d*b.opt.mousescrollstep,true);return b.cancelEvent(c)};this.stop=function(){b.cancelScroll();b.scrollmon&&b.scrollmon.stop();b.cursorfreezed=false;b.scroll.y=Math.round(b.getScrollTop()*(1/b.scrollratio.y));b.noticeCursor();return b};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)return false;b.timer=setTimeout(function(){var c=b.getScrollTop(),c=Math.abs(c-b.newscrolly);b.prepareTransition(c);b.timer=setTimeout(function(){b.setScrollTop(b.newscrolly);
-b.timer=0},15)},b.opt.scrollspeed);b.noticeCursor()},this.cancelScroll=function(){var c=b.getScrollTop();b.prepareTransition(0);b.setScrollTop(c);b.noticeCursor();return b}):(this.doScroll=function(c){function d(){if(b.cancelAnimationFrame)return true;g=(new Date).getTime();if(g<h)return b.timer=k(d)||1;h=Math.floor((new Date).getTime()+b.opt.scrollspeed/2);g=0;var c=b.getScrollTop();if(b.newspeedy)if(c+=b.newspeedy.v,b.newspeedy.v>0){if(c>=b.newspeedy.x)b.newspeedy=false}else{if(c<=b.newspeedy.x)b.newspeedy=
-false}else c=b.newscrolly-b.getScrollTop(),c=c>0?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)||1}b.newscrolly=c;var f=c-b.getScrollTop();b.newspeedy=f*f>100?{x:c-Math.round(f/6),v:Math.round(f/6*5/8)+1}:false;if(!b.timer){var e=0.25,g=0,h=0;b.cancelAnimationFrame=false;b.timer=k(d)||1;b.noticeCursor()}},this.cancelScroll=function(){b.timer&&m(b.timer);b.timer=0;return b});this.doScrollBy=function(c,d){var f=0,
-f=d?b.timer?b.newscrolly-c:b.getScrollTop()-c:Math.floor((b.scroll.y-c)*b.scrollratio.y);if(f<0)f=0;else if(f>b.page.maxh)f=b.page.maxh;b.cursorfreezed=false;b.doScroll(f)};this.doScrollTo=function(c,d){d||Math.round(c*b.scrollratio.y);b.cursorfreezed=false;b.doScroll(c)};b.onscroll=function(){var c=(new Date).getTime();if(!b.lastcontentcheck||b.lastcontentcheck<c)if(b.lastcontentcheck=c+500,b.getContentSize().h!=b.page.h)b.onResize();if(!b.rail.drag){if(!b.cursorfreezed)b.scroll.y=Math.round(b.getScrollTop()*
-(1/b.scrollratio.y));b.noticeCursor()}};b.bind(b.docscroll,"scroll",b.onscroll);this.doZoomIn=function(c){if(!b.zoomactive){b.zoomactive=true;b.zoomrestore={style:{}};var d="position,top,left,zIndex,backgroundColor,marginTop,marginBottom,marginLeft,marginRight".split(","),f=b.win[0].style,g;for(g in d){var h=d[g];b.zoomrestore.style[h]=typeof f[h]!="undefined"?f[h]:""}b.zoomrestore.style.width=b.win.css("width");b.zoomrestore.style.height=b.win.css("height");b.zoomrestore.padding={w:b.win.outerWidth()-
-b.win.width(),h:b.win.outerHeight()-b.win.height()};if(b.isios4)b.zoomrestore.scrollTop=e(window).scrollTop(),e(window).scrollTop(0);b.win.css({position:b.isios4?"absolute":"fixed",top:0,left:0,"z-index":b.opt.zindex+100,margin:"0px"});d=b.win.css("backgroundColor");(d==""||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(d))&&b.win.css("backgroundColor","#fff");b.rail.css({"z-index":b.opt.zindex+110});b.zoom.css({"z-index":b.opt.zindex+112});b.zoom.css("backgroundPosition","0px -18px");b.resizeZoom();
-return b.cancelEvent(c)}};this.doZoomOut=function(c){if(b.zoomactive)return b.zoomactive=false,b.win.css("margin",""),b.win.css(b.zoomrestore.style),b.isios4&&e(window).scrollTop(b.zoomrestore.scrollTop),b.rail.css({"z-index":b.ispage?b.opt.zindex:b.opt.zindex+2}),b.zoom.css({"z-index":b.opt.zindex}),b.zoomrestore=false,b.zoom.css("backgroundPosition","0px 0px"),b.onResize(),b.cancelEvent(c)};this.doZoom=function(c){return b.zoomactive?b.doZoomOut(c):b.doZoomIn(c)};this.resizeZoom=function(){if(b.zoomactive){var c=
-b.getScrollTop();b.win.css({width:e(window).width()-b.zoomrestore.padding.w+"px",height:e(window).height()-b.zoomrestore.padding.h+"px"});b.setScrollTop(c);b.onResize()}};this.init()},u=function(e){var d=this;this.nc=e;this.lasttime=this.speedy=this.lasty=0;this.snapy=false;this.timer=this.demuly=0;this.time=function(){return(new Date).getTime()};this.reset=function(b){d.stop();d.lasttime=d.time();d.speedy=0;d.lasty=b};this.update=function(b){d.lasttime=d.time();var i=b-d.lasty,h=e.getScrollTop()+
-i;d.snapy=h<0||h>d.nc.page.maxh;d.speedy=i;d.lasty=b};this.stop=function(){if(d.timer)clearTimeout(d.timer),d.timer=0};this.doSnapy=function(b){b<0?d.nc.doScrollTo(0,true):b>d.nc.page.maxh&&d.nc.doScrollTo(d.nc.page.maxh,true)};this.doMomentum=function(){var b=d.lasttime,e=d.time();d.speedy=Math.min(200,d.speedy);if(d.speedy&&b&&e-b<=50&&d.speedy){var g=e-b;d.demuly=0;var j=function(){var b=Math.floor(d.nc.getScrollTop()-d.speedy*(1-d.demuly));d.demuly+=0.02;d.nc.setScrollTop(b);d.nc.showCursor(b);
-d.demuly<1?d.timer=setTimeout(j,g):(d.timer=0,d.nc.hideCursor(),d.doSnapy(b))};j()}else d.snapy&&d.doSnapy(d.nc.getScrollTop())}},j=jQuery.fn.scrollTop;e.cssHooks.scrollTop={get:function(g){var d=e.data(g,"__nicescroll")||false;return d&&d.ishwscroll?d.getScrollTop():j.call(g)},set:function(g,d){var b=e.data(g,"__nicescroll")||false;b&&b.ishwscroll?b.setScrollTop(parseInt(d)):j.call(g,d);return this}};jQuery.fn.scrollTop=function(g){if(typeof g=="undefined"){var d=e.data(this,"__nicescroll")||false;
-return d&&d.ishwscroll?d.getScrollTop():j.call(this)}else return this.each(function(){var b=e.data(this,"__nicescroll")||false;b&&b.ishwscroll?b.setScrollTop(parseInt(g)):j.call(e(this),g)})};var p=function(g){var d=this;this.length=0;this.name="nicescrollarray";this.each=function(b){for(var e=0;e<d.length;e++)b.call(d[e]);return d};this.show=function(){return d.each(function(){this.show()})};this.hide=function(){return d.each(function(){this.hide()})};this.onResize=function(){return d.each(function(){this.onResize()})};
-this.resize=function(){return d.each(function(){this.resize()})};this.remove=function(){return d.each(function(){this.remove()})};this.stop=function(){return d.each(function(){this.stop()})};this.push=function(b){d[d.length]=b;d.length++};this.eq=function(b){return d[b]};if(g)for(a=0;a<g.length;a++){var b=e.data(g[a],"__nicescroll")||false;b&&(this[this.length]=b,this.length++)}return this};jQuery.fn.getNiceScroll=function(g){return typeof g=="undefined"?this.length>0?new p(this):e.data(this,"__nicescroll")||
-false:e.data(this[g],"__nicescroll")||false};jQuery.extend(jQuery.expr[":"],{nicescroll:function(g){return e.data(g,"__nicescroll")||false}});e.fn.niceScroll=function(g,d){typeof g=="object"&&typeof d=="undefined"&&(d=g,g=false);var b=new p;typeof d=="undefined"&&(d={});if(g)d.doc=e(g),d.win=e(this);var i=!("doc"in d);this.each(function(){var g=e(this).data("__nicescroll")||false;if(!g)d.doc=i?e(this):d.doc,g=new v(d,e(this)),e(this).data("__nicescroll",g);b.push(g)});return b.length==1?b[0]:b}})(jQuery);
+(function(e){var l=false,n=false,q=5E3,r=2E3,s=function(){var e=document.getElementsByTagName("script"),e=e[e.length-1].src.split("?")[0];return e.split("/").length>0?e.split("/").slice(0,-1).join("/")+"/":""}(),v=function(f,d){var b=this;this.version="2.5.1";this.name="nicescroll";this.me=d;this.opt={doc:e("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,cursorminheight:20};if(f)for(var i in b.opt)typeof f[i]!="undefined"&&(b.opt[i]=f[i]);this.id=b.opt.doc[0].id||"";this.doc=b.opt.doc;this.ispage=/BODY|HTML/.test(b.doc[0].nodeName);this.haswrapper=b.opt.win!==false;this.win=b.opt.win||(this.ispage?e(window):this.doc);this.docscroll=this.ispage?e(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;this.scrollmom=false;do this.id="ascrail"+r++;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;this.events=[];this.saved={};var g=document.createElement("DIV");this.isopera="opera"in window;this.isieold=(this.isie="all"in document&&"attachEvent"in g&&!this.isopera)&&!("msInterpolationMode"in g.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 g.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":g.style.webkitTransform!==void 0?"webkitTransform":g.style.MozTransform!==void 0?"MozTransform":false)&&g.style[this.trstyle]===void 0)this.trstyle=false;if(this.hastransform=this.trstyle!=
+false)g.style[this.trstyle]="translate3d(1px,2px,3px)",this.hastranslate3d=/translate3d/.test(g.style[this.trstyle]);this.transitionstyle=false;this.prefixstyle="";this.transitionend=false;var o="transition,webkitTransition,MozTransition,OTransition,msTransition,KhtmlTransition".split(","),t=",-webkit-,-moz-,-o-,-ms-,-khtml-".split(","),j="transitionEnd,webkitTransitionEnd,transitionend,oTransitionEnd,msTransitionEnd,KhtmlTransitionEnd".split(",");for(i=0;i<o.length;i++)if(o[i]in g.style){this.transitionstyle=
+o[i];this.prefixstyle=t[i];this.transitionend=j[i];break}this.hastransition=this.transitionstyle}else this.transitionend=this.hastransition=this.transitionstyle=this.hastranslate3d=this.hastransform=this.trstyle=false;this.cursorgrabvalue="";if(b.opt.grabcursorenabled&&b.opt.touchbehavior)this.cursorgrabvalue=function(){if(!b.isie||b.isie9)for(var c=["grab","-moz-grab","-webkit-grab"],h=0;h<c.length;h++){var d=c[h];g.style.cursor=d;if(g.style.cursor==d)return d}return"url(http://www.google.com/intl/en_ALL/mapfiles/openhand.cur),n-resize"}();
+g=null;this.ishwscroll=b.hastransform&&b.opt.hwacceleration&&b.haswrapper;this.scrollTop=function(c){return c===void 0?b.getScrollTop():b.setScrollTop(c)};this.ishwscroll?(b.doc.translate={x:0,y:0},this.getScrollTop=function(){return b.doc.translate.y},this.notifyScrollEvent=document.createEvent?function(b){var h=document.createEvent("UIEvents");h.initUIEvent("scroll",false,true,window,1);b.dispatchEvent(h)}:document.fireEvent?function(b){var h=document.createEventObject();b.fireEvent("onscroll");
+h.cancelBubble=true}:function(){},this.setScrollTop=this.hastranslate3d?function(c,h){b.doc.css(b.trstyle,"translate3d(0px,"+c*-1+"px,0px)");b.doc.translate.y=c;h||b.notifyScrollEvent(b.docscroll[0])}:function(c,h){b.doc.css(b.trstyle,"translate(0px,"+c*-1+"px)");b.doc.translate.y=c;h||b.notifyScrollEvent(b.docscroll[0])}):(this.getScrollTop=function(){return b.docscroll.scrollTop()},this.setScrollTop=function(c){return b.docscroll.scrollTop(c)});this.getTarget=function(b){return!b?false:b.target?
+b.target:b.srcElement?b.srcElement:false};this.hasParent=function(b,h){if(!b)return false;for(var d=b.target||b.srcElement||b||false;d&&d.id!=h;)d=d.parentNode||false;return d!==false};this.updateScrollBar=function(c){if(b.ishwscroll)b.rail.css({height:b.win.innerHeight()});else{var d=b.win.offset();d.top+=2;var e=(b.win.outerWidth()-b.win.innerWidth())/2;d.left+=b.win.innerWidth()+e-b.rail.width-1;b.rail.css({position:"absolute",top:d.top,left:d.left,height:c?c.h:b.win.innerHeight()});b.zoom&&b.zoom.css({position:"absolute",
+top:d.top+1,left:d.left-20})}};var k=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||false,m=window.cancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||false;b.hasanimationframe=k;b.hascancelanimationframe=m;b.hasanimationframe?b.hascancelanimationframe||
+(m=function(){b.cancelAnimationFrame=true}):(k=function(b){return setTimeout(b,1E3/60)},m=clearInterval);this.init=function(){b.saved.css=[];b.ispage&&b.saved.css.push([b.doc,"overflow-y",b.doc.css("overflow-y")]);b.ispage||b.saved.css.push([b.docscroll,"overflow-y",b.docscroll.css("overflow-y")]);b.ispage&&b.isie7&&b.saved.css.push([e("html"),"overflow-y",e("html").css("overflow-y")]);if(!b.ispage||!b.cantouch&&!b.isieold){b.ispage?b.doc.css({"overflow-y":"hidden"}):b.docscroll.css({"overflow-y":"hidden"});
+b.ispage&&b.isie7&&e("html").css({"overflow-y":"hidden"});var c=e(document.createElement("div"));c.css({position:"relative",top:0,"float":"right",width:b.opt.cursorwidth,height:"0px","background-color":b.opt.cursorcolor,border:b.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":b.opt.cursorborderradius,"-moz-border-radius":b.opt.cursorborderradius,"border-radius":b.opt.cursorborderradius});c.hborder=parseFloat(c.outerHeight()-c.innerHeight());b.cursor=c;var d=e(document.createElement("div"));
+d.attr("id",b.id);d.width=3+Math.max(parseFloat(b.opt.cursorwidth),c.outerWidth());d.css({"padding-left":"0px","padding-right":"1px",width:d.width+"px",zIndex:b.ispage?b.opt.zindex:b.opt.zindex+2,background:b.opt.background});d.append(c);b.rail=d;c=false;if(b.opt.boxzoom&&!b.ispage&&!b.isieold)c=document.createElement("div"),b.bind(c,"click",b.doZoom),b.zoom=e(c),b.zoom.css({cursor:"pointer","z-index":b.opt.zindex,backgroundImage:"url("+s+"zoomico.png)",height:18,width:18,backgroundPosition:"0px 0px"}),
+b.opt.dblclickzoom&&b.bind(b.win,"dblclick",b.doZoom),b.cantouch&&b.opt.gesturezoom&&b.bind(b.win,"gestureend",function(c){c.scale>1.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+4}),b.win.append(b.zoom)),d.css({position:"absolute",
+top:0,right:0}),b.win.append(d)):(b.updateScrollBar(),e("body").append(d),b.zoom&&e("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&&e(window).resize(b.resizeZoom);
+b.istextarea&&b.win.mouseup(b.onResize);b.onResize();b.cantouch||b.opt.touchbehavior?(b.scrollmom={y:new u(b)},b.onmousedown=function(c){if(!b.locked&&(b.cancelScroll(),b.rail.drag={x:c.pageX,y:c.pageY,sx:b.scroll.x,sy:b.scroll.y,st:b.getScrollTop()},b.hasmoving=false,b.scrollmom.y.reset(c.pageY),!b.cantouch))return b.cancelEvent(c)},b.onmouseup=function(c){if(b.rail.drag&&(b.scrollmom.y.doMomentum(),b.rail.drag=false,b.hasmoving))return b.hasmoving=false,b.cancelEvent(c)},b.onmousemove=function(c){if(b.rail.drag){b.hasmoving=
+true;var d=c.pageY-b.rail.drag.y;b.scrollmom.y.update(c.pageY);b.showCursor(b.rail.drag.st-d);b.prepareTransition&&b.prepareTransition(0);b.setScrollTop(b.rail.drag.st-d);return b.cancelEvent(c)}},b.cursorgrabvalue&&(b.saved.css.push([b.win,"cursor",b.win.css("cursor")]),b.win.css({cursor:b.cursorgrabvalue}))):(b.onmousedown=function(c){if(b.locked)return b.cancelEvent(c);b.cancelScroll();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.hasmoving=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:q++}),
+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){n=b.getTarget(c).id||true;b.hasmousefocus=true;b.noticeCursor()}),b.win.mouseleave(function(){n=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&&!n){d=c.keyCode;if(b.locked&&d!=27)return b.cancelEvent(c);var h=true;switch(d){case 38:case 63233:b.doScrollBy(72,true);h=false;break;case 40:case 63235:b.doScrollBy(-72,true);h=false;break;case 33:case 63276:b.doScrollBy(b.view.h,true);h=false;break;case 34:case 63277:b.doScrollBy(-b.view.h,true);h=false;break;case 36:case 63273:b.doScrollTo(0,true);h=false;break;case 35:case 63275:b.doScrollTo(b.page.maxh,true);h=false;break;case 27:b.zoomactive&&(b.doZoom(),h=false)}if(!h)return b.cancelEvent(c)}};
+b.bind(document,b.isopera?"keypress":"keydown",b.onkeypress)}if(this.doc[0].nodeName=="IFRAME"){var f=function(){var c="contentDocument"in this?this.contentDocument:this.contentWindow.document;if(b.isiframe)b.docscroll=e(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&&b.saved.css.push([e(c).find("html"),"overflow-y",e(c).find("html").css("overflow-y")]);b.saved.css.push([e(c.body),"overflow-y",e(c.body).css("overflow-y")]);b.isie7&&e(c).find("html").css({"overflow-y":"hidden"});e(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&&(b.saved.css.push([e(c),"cursor",e(c).css("cursor")]),e(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(){f.call(b.doc[0],
+false)},500);this.doc.load(f)}};this.showCursor=function(c){if(b.cursortimeout)clearTimeout(b.cursortimeout),b.cursortimeout=0;if(b.rail){b.autohidedom&&b.autohidedom.stop().css({opacity:b.opt.cursoropacitymax});if(typeof c!="undefined")b.scroll.y=Math.round(c*1/b.scrollratio.y);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.resize=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();
+b.page.maxh=b.page.h-b.view.h;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.cursorheight=Math.max(b.opt.cursorminheight,b.cursorheight);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();return b};this._bind=function(c,d,e,f){b.events.push({e:c,n:d,f:e});c.addEventListener?c.addEventListener(d,e,f||false):c.attachEvent?c.attachEvent("on"+d,e):c["on"+d]=e};this.bind=function(c,d,e,f){var g=c.length&&"selector"in c?c[0]:c;g.addEventListener?(b.cantouch&&/mouseup|mousedown|mousemove/.test(d)&&b._bind(g,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),b._bind(g,d,e,f||false),d=="mousewheel"&&b._bind(g,"DOMMouseScroll",e,f||false),b.cantouch&&d=="mouseup"&&b._bind(g,"touchcancel",e,f||false)):b._bind(g,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})};this._unbind=function(b,d,e){b.removeEventListener?
+b.removeEventListener(d,e,false):b.detachEvent?b.detachEvent("on"+d,e):b["on"+d]=false};this.unbindAll=function(){for(var c=0;c<b.events.length;c++){var d=b.events[c];b._unbind(d.e,d.n,d.f)}};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");return b};this.hide=function(){b.visibility=false;b.rail.css("display","none");return b};this.remove=function(){b.doZoomOut();b.unbindAll();b.events=[];b.rail.remove();b.zoom&&b.zoom.remove();b.cursor=false;b.rail=false;b.zoom=false;for(var c=0;c<b.saved.css.length;c++){var d=b.saved.css[c];d[0].css(d[1],typeof d[2]=="undefined"?"":d[2])}b.saved=false;b.me.data("__nicescroll","");return b};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;if(d=c.detail?c.detail*-1:c.wheelDelta/40)b.scrollmom&&b.scrollmom.y.stop(),b.doScrollBy(d*b.opt.mousescrollstep,true);return b.cancelEvent(c)};this.stop=function(){b.cancelScroll();b.scrollmon&&b.scrollmon.stop();b.cursorfreezed=false;b.scroll.y=Math.round(b.getScrollTop()*(1/b.scrollratio.y));b.noticeCursor();return b};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)return false;b.timer=setTimeout(function(){var c=b.getScrollTop(),c=Math.abs(c-b.newscrolly);b.prepareTransition(c);b.timer=setTimeout(function(){b.setScrollTop(b.newscrolly);b.timer=0},15)},b.opt.scrollspeed);b.noticeCursor()},this.cancelScroll=function(){var c=b.getScrollTop();b.prepareTransition(0);
+b.setScrollTop(c);b.noticeCursor();return b}):(this.doScroll=function(c){function d(){if(b.cancelAnimationFrame)return true;g=(new Date).getTime();if(g<i)return b.timer=k(d)||1;i=Math.floor((new Date).getTime()+b.opt.scrollspeed/2);g=0;var c=b.getScrollTop();if(b.newspeedy)if(c+=b.newspeedy.v,b.newspeedy.v>0){if(c>=b.newspeedy.x)b.newspeedy=false}else{if(c<=b.newspeedy.x)b.newspeedy=false}else c=b.newscrolly-b.getScrollTop(),c=(c=c>0?Math.ceil(c*f):Math.floor(c*f))?b.getScrollTop()+c:b.newscrolly;
+b.setScrollTop(c);c==b.newscrolly?(b.timer=0,b.cursorfreezed=false):b.timer=k(d)||1}b.newscrolly=c;var e=c-b.getScrollTop();b.newspeedy=e*e>100?{x:c-Math.round(e/6),v:Math.round(e/6*5/8+0.5)}:false;if(!b.timer){var f=0.25,g=0,i=0;b.cancelAnimationFrame=false;b.timer=k(d)||1;b.noticeCursor()}},this.cancelScroll=function(){b.timer&&m(b.timer);b.timer=0;return b});this.doScrollBy=function(c,d){var e=0,e=d?b.timer?b.newscrolly-c:b.getScrollTop()-c:Math.floor((b.scroll.y-c)*b.scrollratio.y);if(e<0)e=0;
+else if(e>b.page.maxh)e=b.page.maxh;b.cursorfreezed=false;b.doScroll(e)};this.doScrollTo=function(c,d){d||Math.round(c*b.scrollratio.y);b.cursorfreezed=false;b.doScroll(c)};b.onscroll=function(){var c=(new Date).getTime();if(!b.lastcontentcheck||b.lastcontentcheck<c)if(b.lastcontentcheck=c+500,b.getContentSize().h!=b.page.h)b.onResize();if(!b.rail.drag){if(!b.cursorfreezed)b.scroll.y=Math.round(b.getScrollTop()*(1/b.scrollratio.y));b.noticeCursor()}};b.bind(b.docscroll,"scroll",b.onscroll);this.doZoomIn=
+function(c){if(!b.zoomactive){b.zoomactive=true;b.zoomrestore={style:{}};var d="position,top,left,zIndex,backgroundColor,marginTop,marginBottom,marginLeft,marginRight".split(","),f=b.win[0].style,g;for(g in d){var i=d[g];b.zoomrestore.style[i]=typeof f[i]!="undefined"?f[i]:""}b.zoomrestore.style.width=b.win.css("width");b.zoomrestore.style.height=b.win.css("height");b.zoomrestore.padding={w:b.win.outerWidth()-b.win.width(),h:b.win.outerHeight()-b.win.height()};if(b.isios4)b.zoomrestore.scrollTop=
+e(window).scrollTop(),e(window).scrollTop(0);b.win.css({position:b.isios4?"absolute":"fixed",top:0,left:0,"z-index":b.opt.zindex+100,margin:"0px"});d=b.win.css("backgroundColor");(d==""||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(d))&&b.win.css("backgroundColor","#fff");b.rail.css({"z-index":b.opt.zindex+110});b.zoom.css({"z-index":b.opt.zindex+112});b.zoom.css("backgroundPosition","0px -18px");b.resizeZoom();return b.cancelEvent(c)}};this.doZoomOut=function(c){if(b.zoomactive)return b.zoomactive=
+false,b.win.css("margin",""),b.win.css(b.zoomrestore.style),b.isios4&&e(window).scrollTop(b.zoomrestore.scrollTop),b.rail.css({"z-index":b.ispage?b.opt.zindex:b.opt.zindex+2}),b.zoom.css({"z-index":b.opt.zindex}),b.zoomrestore=false,b.zoom.css("backgroundPosition","0px 0px"),b.onResize(),b.cancelEvent(c)};this.doZoom=function(c){return b.zoomactive?b.doZoomOut(c):b.doZoomIn(c)};this.resizeZoom=function(){if(b.zoomactive){var c=b.getScrollTop();b.win.css({width:e(window).width()-b.zoomrestore.padding.w+
+"px",height:e(window).height()-b.zoomrestore.padding.h+"px"});b.setScrollTop(c);b.onResize()}};this.init()},u=function(e){var d=this;this.nc=e;this.lasttime=this.speedy=this.lasty=0;this.snapy=false;this.timer=this.demuly=0;this.time=function(){return(new Date).getTime()};this.reset=function(b){d.stop();d.lasttime=d.time();d.speedy=0;d.lasty=b};this.update=function(b){d.lasttime=d.time();var i=b-d.lasty,g=e.getScrollTop()+i;d.snapy=g<0||g>d.nc.page.maxh;d.speedy=i;d.lasty=b};this.stop=function(){if(d.timer)clearTimeout(d.timer),
+d.timer=0};this.doSnapy=function(b){b<0?d.nc.doScrollTo(0,true):b>d.nc.page.maxh&&d.nc.doScrollTo(d.nc.page.maxh,true)};this.doMomentum=function(){var b=d.lasttime,e=d.time();d.speedy=Math.min(200,d.speedy);if(d.speedy&&b&&e-b<=50&&d.speedy){var f=e-b;d.demuly=0;var j=function(){var b=Math.floor(d.nc.getScrollTop()-d.speedy*(1-d.demuly));d.demuly+=0.02;d.nc.setScrollTop(b);d.nc.showCursor(b);d.demuly<1?d.timer=setTimeout(j,f):(d.timer=0,d.nc.hideCursor(),d.doSnapy(b))};j()}else d.snapy&&d.doSnapy(d.nc.getScrollTop())}},
+j=jQuery.fn.scrollTop;e.cssHooks.scrollTop={get:function(f){var d=e.data(f,"__nicescroll")||false;return d&&d.ishwscroll?d.getScrollTop():j.call(f)},set:function(f,d){var b=e.data(f,"__nicescroll")||false;b&&b.ishwscroll?b.setScrollTop(parseInt(d)):j.call(f,d);return this}};jQuery.fn.scrollTop=function(f){if(typeof f=="undefined"){var d=e.data(this[0],"__nicescroll")||false;return d&&d.ishwscroll?d.getScrollTop():j.call(this)}else return this.each(function(){var b=e.data(this,"__nicescroll")||false;
+b&&b.ishwscroll?b.setScrollTop(parseInt(f)):j.call(e(this),f)})};var p=function(f){var d=this;this.length=0;this.name="nicescrollarray";this.each=function(b){for(var e=0;e<d.length;e++)b.call(d[e]);return d};this.show=function(){return d.each(function(){this.show()})};this.hide=function(){return d.each(function(){this.hide()})};this.onResize=function(){return d.each(function(){this.onResize()})};this.resize=function(){return d.each(function(){this.resize()})};this.remove=function(){return d.each(function(){this.remove()})};
+this.stop=function(){return d.each(function(){this.stop()})};this.push=function(b){d[d.length]=b;d.length++};this.eq=function(b){return d[b]};if(f)for(a=0;a<f.length;a++){var b=e.data(f[a],"__nicescroll")||false;b&&(this[this.length]=b,this.length++)}return this};jQuery.fn.getNiceScroll=function(f){return typeof f=="undefined"?new p(this):e.data(this[f],"__nicescroll")||false};jQuery.extend(jQuery.expr[":"],{nicescroll:function(f){return e.data(f,"__nicescroll")||false}});e.fn.niceScroll=function(f,
+d){typeof f=="object"&&typeof d=="undefined"&&(d=f,f=false);var b=new p;typeof d=="undefined"&&(d={});if(f)d.doc=e(f),d.win=e(this);var i=!("doc"in d);this.each(function(){var f=e(this).data("__nicescroll")||false;if(!f)d.doc=i?e(this):d.doc,f=new v(d,e(this)),e(this).data("__nicescroll",f);b.push(f)});return b.length==1?b[0]:b}})(jQuery);