File: //proc/self/root/home/madepabj/gharana.pk/wp-content/themes/flex-mag/js/scripts.js
jQuery(document).ready(function(e){"use strict";e(window).load(function(){var t=e("#head-main-top").outerHeight();e(window).scroll(function(){e(window).scrollTop()>t?(e("#main-nav-wrap").addClass("fixed").css("top","0"),e(".nav-logo-fade").addClass("nav-logo-show"),e(".nav-logo-out").addClass("nav-logo-out-fade"),e(".nav-logo-in").addClass("nav-logo-in-fade"),e(".nav-left-wrap").addClass("nav-left-width"),e("#wallpaper").addClass("wall-fixed"),e(".col-tabs-wrap").addClass("fixed-col").css("top","50px"),e("#body-main-wrap").addClass("tabs-top-marg"),e("#body-main-wrap").addClass("body-top-pad"),e(".fly-to-top").addClass("to-top-trans")):(e("#main-nav-wrap").removeClass("fixed"),e(".nav-logo-fade").removeClass("nav-logo-show"),e(".nav-logo-out").removeClass("nav-logo-out-fade"),e(".nav-logo-in").removeClass("nav-logo-in-fade"),e(".nav-left-wrap").removeClass("nav-left-width"),e("#wallpaper").removeClass("wall-fixed"),e(".col-tabs-wrap").removeClass("fixed-col").css("top","0"),e("#body-main-wrap").removeClass("tabs-top-marg"),e("#body-main-wrap").removeClass("body-top-pad"),e(".fly-to-top").removeClass("to-top-trans"))})}),e(".fly-but-wrap").on("click",function(){e("#fly-wrap").toggleClass("fly-menu"),e("#head-main-top").toggleClass("fly-content"),e("#wallpaper").toggleClass("fly-content"),e(".col-tabs-wrap").toggleClass("fly-content"),e("#main-nav-wrap").toggleClass("main-nav-over"),e("#soc-nav-wrap").toggleClass("fly-content"),e("#body-main-wrap").toggleClass("fly-content"),e(".fly-but-wrap").toggleClass("fly-open"),e(".fly-fade").toggleClass("fly-fade-trans")});e(".back-to-top").on("click",function(t){return t.preventDefault(),e("html, body").animate({scrollTop:0},500),!1}),e(".nav-search-but").on("click",function(){e(".search-fly-wrap").slideToggle()}),e("#site-wrap").each(function(){e(this).find("ul.col-tabs li.feat-col-tab").addClass("active").show()}),e("ul.col-tabs li").on("click",function(t){e(this).parents("#site-wrap").find("ul.col-tabs li").removeClass("active"),e(this).addClass("active"),e(this).parents("#site-wrap").find(".tab-col-cont").hide();var o=e(this).find("a").attr("href");return e(this).parents("#site-wrap").find(o).fadeIn(),e("html, body").animate({scrollTop:0},500),!1}),e("ul.col-tabs li a").on("click",function(e){e.preventDefault()}),e(".non-feat-tab").on("click",function(t){e("#feat-top-wrap").hide(),e("#feat-wide-wrap").hide()}),e(".feat-col-tab").on("click",function(t){e("#feat-top-wrap").fadeIn(),e("#feat-wide-wrap").fadeIn()})}),function(e,t,o){t.fn.touchwipe=function(e){var o={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:!0};return e&&t.extend(o,e),this.each(function(){var e,t,i=!1;function n(){this.removeEventListener("touchmove",r),e=null,i=!1}function r(r){if(o.preventDefaultEvents&&r.preventDefault(),i){var s=r.touches[0].pageX,a=r.touches[0].pageY,l=e-s,c=t-a;Math.abs(l)>=o.min_move_x?(n(),l>0?o.wipeLeft():o.wipeRight()):Math.abs(c)>=o.min_move_y&&(n(),c>0?o.wipeDown():o.wipeUp())}}"ontouchstart"in document.documentElement&&this.addEventListener("touchstart",function(o){1==o.touches.length&&(e=o.touches[0].pageX,t=o.touches[0].pageY,i=!0,this.addEventListener("touchmove",r,!1))},!1)}),this},t.elastislide=function(e,o){this.$el=t(o),this._init(e)},t.elastislide.defaults={speed:450,easing:"",imageW:190,margin:0,border:0,minItems:1,current:0,onClick:function(){return!1}},t.elastislide.prototype={_init:function(e){this.options=t.extend(!0,{},t.elastislide.defaults,e),this.$slider=this.$el.find("ul"),this.$items=this.$slider.children("li"),this.itemsCount=this.$items.length,this.$esCarousel=this.$slider.parent(),this._validateOptions(),this._configure(),this._addControls(),this._initEvents(),this.$slider.show(),this._slideToCurrent(!1)},_validateOptions:function(){this.options.speed<0&&(this.options.speed=450),this.options.margin<0&&(this.options.margin=4),this.options.border<0&&(this.options.border=1),(this.options.minItems<1||this.options.minItems>this.itemsCount)&&(this.options.minItems=1),this.options.current>this.itemsCount-1&&(this.options.current=0)},_configure:function(){this.current=this.options.current,this.visibleWidth=this.$esCarousel.width(),this.visibleWidth<this.options.minItems*(this.options.imageW+2*this.options.border)+(this.options.minItems-1)*this.options.margin?(this._setDim((this.visibleWidth-(this.options.minItems-1)*this.options.margin)/this.options.minItems),this._setCurrentValues(),this.fitCount=this.options.minItems):(this._setDim(),this._setCurrentValues()),this.$slider.css({width:this.sliderW})},_setDim:function(e){this.$items.css({marginRight:this.options.margin,width:e||this.options.imageW+2*this.options.border}).children("a").css({borderWidth:this.options.border})},_setCurrentValues:function(){this.itemW=this.$items.outerWidth(!0),this.sliderW=this.itemW*this.itemsCount,this.visibleWidth=this.$esCarousel.width(),this.fitCount=Math.floor(this.visibleWidth/this.itemW)},_addControls:function(){this.$navNext=t('<span class="es-nav-next"><a>></a></span>'),this.$navPrev=t('<span class="es-nav-prev"><a><</a></span>'),t('<div class="es-nav"/>').append(this.$navPrev).append(this.$navNext).appendTo(this.$el)},_toggleControls:function(e,t){e&&t?1===t?"right"===e?this.$navNext.show():this.$navPrev.show():"right"===e?this.$navNext.hide():this.$navPrev.hide():(this.current===this.itemsCount-1||this.fitCount>=this.itemsCount)&&this.$navNext.hide()},_initEvents:function(){var o=this;t(e).bind("resize.elastislide",function(e){o._setCurrentValues(),o.visibleWidth<o.options.minItems*(o.options.imageW+2*o.options.border)+(o.options.minItems-1)*o.options.margin?(o._setDim((o.visibleWidth-(o.options.minItems-1)*o.options.margin)/o.options.minItems),o._setCurrentValues(),o.fitCount=o.options.minItems):(o._setDim(),o._setCurrentValues()),o.$slider.css({width:o.sliderW+10}),clearTimeout(o.resetTimeout),o.resetTimeout=setTimeout(function(){o._slideToCurrent()},200)}),this.$navNext.bind("click.elastislide",function(e){o._slide("right")}),this.$navPrev.bind("click.elastislide",function(e){o._slide("left")}),this.$items.bind("click.elastislide",function(e){o.options.onClick(t(this))}),o.$slider.touchwipe({wipeLeft:function(){o._slide("right")},wipeRight:function(){o._slide("left")}})},_slide:function(e,o,i,n){if(this.$slider.is(":animated"))return!1;var r=parseFloat(this.$slider.css("margin-left"));if(void 0===o){var s=this.fitCount*this.itemW;if(s<0)return!1;if("right"===e&&this.sliderW-(Math.abs(r)+s)<this.visibleWidth)s=this.sliderW-(Math.abs(r)+this.visibleWidth)-this.options.margin,this._toggleControls("right",-1),this._toggleControls("left",1);else if("left"===e&&Math.abs(r)-s<0)s=Math.abs(r),this._toggleControls("left",-1),this._toggleControls("right",1);else{(a="right"===e?Math.abs(r)+this.options.margin+Math.abs(s):Math.abs(r)-this.options.margin-Math.abs(s))>0?this._toggleControls("left",1):this._toggleControls("left",-1),a<this.sliderW-this.visibleWidth?this._toggleControls("right",1):this._toggleControls("right",-1)}o="right"===e?"-="+s:"+="+s}else{var a=Math.abs(o);Math.max(this.sliderW,this.visibleWidth)-a<this.visibleWidth&&(0!==(o=-(Math.max(this.sliderW,this.visibleWidth)-this.visibleWidth))&&(o+=this.options.margin),this._toggleControls("right",-1),a=Math.abs(o)),a>0?this._toggleControls("left",1):this._toggleControls("left",-1),Math.max(this.sliderW,this.visibleWidth)-this.visibleWidth>a+this.options.margin?this._toggleControls("right",1):this._toggleControls("right",-1)}t.fn.applyStyle=void 0===i?t.fn.animate:t.fn.css;var l={marginLeft:o};this.$slider.applyStyle(l,t.extend(!0,[],{duration:this.options.speed,easing:this.options.easing,complete:function(){n&&n.call()}}))},_slideToCurrent:function(e){var t=this.current*this.itemW;this._slide("",-t,e)},add:function(e,t){this.$items=this.$items.add(e),this.itemsCount=this.$items.length,this._setDim(),this._setCurrentValues(),this.$slider.css({width:this.sliderW}),this._slideToCurrent(),t&&t.call(e)},destroy:function(e){this._destroy(e)},_destroy:function(o){this.$el.unbind(".elastislide").removeData("elastislide"),t(e).unbind(".elastislide"),o&&o.call()}};var i=function(e){this.console&&console.error(e)};t.fn.elastislide=function(e){if("string"==typeof e){var o=Array.prototype.slice.call(arguments,1);this.each(function(){var n=t.data(this,"elastislide");n?t.isFunction(n[e])&&"_"!==e.charAt(0)?n[e].apply(n,o):i("no such method '"+e+"' for elastislide instance"):i("cannot call methods on elastislide prior to initialization; attempted to call method '"+e+"'")})}else this.each(function(){t.data(this,"elastislide")||t.data(this,"elastislide",new t.elastislide(e,this))});return this}}(window,jQuery),function(e){var t=!1,o=!1,i=5e3,n=2e3,r=0,s=e;var l,c,d=(l=document.getElementsByTagName("script"),(c=l[l.length-1].src.split("?")[0]).split("/").length>0?c.split("/").slice(0,-1).join("/")+"/":""),u=["ms","moz","webkit","o"],h=window.requestAnimationFrame||!1,p=window.cancelAnimationFrame||!1;if(!h)for(var m in u){var v=u[m];h||(h=window[v+"RequestAnimationFrame"]),p||(p=window[v+"CancelAnimationFrame"]||window[v+"CancelRequestAnimationFrame"])}var f=window.MutationObserver||window.WebKitMutationObserver||!1,g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"5px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:24,touchbehavior:!1,hwacceleration:!0,usetransition:!0,boxzoom:!1,dblclickzoom:!0,gesturezoom:!0,grabcursorenabled:!0,autohidemode:!0,background:"",iframeautoresize:!0,cursorminheight:32,preservenativescrolling:!0,railoffset:!1,bouncescroll:!0,spacebarenabled:!0,railpadding:{top:0,right:0,left:0,bottom:0},disableoutline:!0,horizrailenabled:!0,railalign:"right",railvalign:"bottom",enabletranslate3d:!0,enablemousewheel:!0,enablekeyboard:!0,smoothscroll:!0,sensitiverail:!0,enablemouselockapi:!0,cursorfixedheight:!1,directionlockdeadzone:6,hidecursordelay:400,nativeparentscrolling:!0,enablescrollonselection:!0,overflowx:!0,overflowy:!0,cursordragspeed:.3,rtlmode:!1,cursordragontouch:!1,oneaxismousemode:"auto"},w=!1,b=function(e,a){var l=this;if(this.version="3.5.0 BETA5",this.name="nicescroll",this.me=a,this.opt={doc:s("body"),win:!1},s.extend(this.opt,g),this.opt.snapbackspeed=80,e)for(var c in l.opt)void 0!==e[c]&&(l.opt[c]=e[c]);this.doc=l.opt.doc,this.iddoc=this.doc&&this.doc[0]&&this.doc[0].id||"",this.ispage=/BODY|HTML/.test(l.opt.win?l.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==l.opt.win,this.win=l.opt.win||(this.ispage?s(window):this.doc),this.docscroll=this.ispage&&!this.haswrapper?s(window):this.win,this.body=s("body"),this.viewport=!1,this.isfixed=!1,this.iframe=!1,this.isiframe="IFRAME"==this.doc[0].nodeName&&"IFRAME"==this.win[0].nodeName,this.istextarea="TEXTAREA"==this.win[0].nodeName,this.forcescreen=!1,this.canshowonmouseevent="scroll"!=l.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,this.checkrtlmode=!1,this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1;do{this.id="ascrail"+n++}while(document.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.overflowx=l.opt.overflowx,this.overflowy=l.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=function(){if(w)return w;var e=document.createElement("DIV"),t={};t.haspointerlock="pointerLockElement"in document||"mozPointerLockElement"in document||"webkitPointerLockElement"in document,t.isopera="opera"in window,t.isopera12=t.isopera&&"getUserMedia"in navigator,t.isoperamini="[object OperaMini]"===Object.prototype.toString.call(window.operamini),t.isie="all"in document&&"attachEvent"in e&&!t.isopera,t.isieold=t.isie&&!("msInterpolationMode"in e.style),t.isie7=t.isie&&!t.isieold&&(!("documentMode"in document)||7==document.documentMode),t.isie8=t.isie&&"documentMode"in document&&8==document.documentMode,t.isie9=t.isie&&"performance"in window&&document.documentMode>=9,t.isie10=t.isie&&"performance"in window&&document.documentMode>=10,t.isie9mobile=/iemobile.9/i.test(navigator.userAgent),t.isie9mobile&&(t.isie9=!1),t.isie7mobile=!t.isie9mobile&&t.isie7&&/iemobile/i.test(navigator.userAgent),t.ismozilla="MozAppearance"in e.style,t.iswebkit="WebkitAppearance"in e.style,t.ischrome="chrome"in window,t.ischrome22=t.ischrome&&t.haspointerlock,t.ischrome26=t.ischrome&&"transition"in e.style,t.cantouch="ontouchstart"in document.documentElement||"ontouchstart"in window,t.hasmstouch=window.navigator.msPointerEnabled||!1,t.ismac=/^mac$/i.test(navigator.platform),t.isios=t.cantouch&&/iphone|ipad|ipod/i.test(navigator.platform),t.isios4=t.isios&&!("seal"in Object),t.isandroid=/android/i.test(navigator.userAgent),t.trstyle=!1,t.hastransform=!1,t.hastranslate3d=!1,t.transitionstyle=!1,t.hastransition=!1,t.transitionend=!1;for(var o=["transform","msTransform","webkitTransform","MozTransform","OTransform"],i=0;i<o.length;i++)if(void 0!==e.style[o[i]]){t.trstyle=o[i];break}t.hastransform=0!=t.trstyle,t.hastransform&&(e.style[t.trstyle]="translate3d(1px,2px,3px)",t.hastranslate3d=/translate3d/.test(e.style[t.trstyle])),t.transitionstyle=!1,t.prefixstyle="",t.transitionend=!1;o=["transition","webkitTransition","MozTransition","OTransition","OTransition","msTransition","KhtmlTransition"];var n=["","-webkit-","-moz-","-o-","-o","-ms-","-khtml-"],r=["transitionend","webkitTransitionEnd","transitionend","otransitionend","oTransitionEnd","msTransitionEnd","KhtmlTransitionEnd"];for(i=0;i<o.length;i++)if(o[i]in e.style){t.transitionstyle=o[i],t.prefixstyle=n[i],t.transitionend=r[i];break}return t.ischrome26&&(t.prefixstyle=n[1]),t.hastransition=t.transitionstyle,t.cursorgrabvalue=function(){var o=["-moz-grab","-webkit-grab","grab"];(t.ischrome&&!t.ischrome22||t.isie)&&(o=[]);for(var i=0;i<o.length;i++){var n=o[i];if(e.style.cursor=n,e.style.cursor==n)return n}return"url(http://www.google.com/intl/en_ALL/mapfiles/openhand.cur),n-resize"}(),t.hasmousecapture="setCapture"in e,t.hasMutationObserver=!1!==f,e=null,w=t,t}();var u=s.extend({},this.detected);if(this.canhwscroll=u.hastransform&&l.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&l.haswrapper,this.istouchcapable=!1,u.cantouch&&u.ischrome&&!u.isios&&!u.isandroid&&(this.istouchcapable=!0,u.cantouch=!1),u.cantouch&&u.ismozilla&&!u.isios&&!u.isandroid&&(this.istouchcapable=!0,u.cantouch=!1),l.opt.enablemouselockapi||(u.hasmousecapture=!1,u.haspointerlock=!1),this.delayed=function(e,t,o,i){var n=l.delaylist[e],r=(new Date).getTime();if(!i&&n&&n.tt)return!1;n&&n.tt&&clearTimeout(n.tt),n&&n.last+o>r&&!n.tt?l.delaylist[e]={last:r+o,tt:setTimeout(function(){l.delaylist[e].tt=0,t.call()},o)}:n&&n.tt||(l.delaylist[e]={last:r,tt:0},setTimeout(function(){t.call()},0))},this.debounced=function(e,t,o){var i=l.delaylist[e];(new Date).getTime();l.delaylist[e]=t,i||setTimeout(function(){var t=l.delaylist[e];l.delaylist[e]=!1,t.call()},o)},this.synched=function(e,t){return l.synclist[e]=t,l.onsync||(h(function(){for(e in l.onsync=!1,l.synclist){var t=l.synclist[e];t&&t.call(l),l.synclist[e]=!1}}),l.onsync=!0),e},this.unsynched=function(e){l.synclist[e]&&(l.synclist[e]=!1)},this.css=function(e,t){for(var o in t)l.saved.css.push([e,o,e.css(o)]),e.css(o,t[o])},this.scrollTop=function(e){return void 0===e?l.getScrollTop():l.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?l.getScrollLeft():l.setScrollLeft(e)},BezierClass=function(e,t,o,i,n,r,s){this.st=e,this.ed=t,this.spd=o,this.p1=i||0,this.p2=n||1,this.p3=r||0,this.p4=s||1,this.ts=(new Date).getTime(),this.df=this.ed-this.st},BezierClass.prototype={B2:function(e){return 3*e*e*(1-e)},B3:function(e){return 3*e*(1-e)*(1-e)},B4:function(e){return(1-e)*(1-e)*(1-e)},getNow:function(){var e=1-((new Date).getTime()-this.ts)/this.spd,t=this.B2(e)+this.B3(e)+this.B4(e);return e<0?this.ed:this.st+Math.round(this.df*t)},update:function(e,t){return this.st=this.getNow(),this.ed=e,this.spd=t,this.ts=(new Date).getTime(),this.df=this.ed-this.st,this}},this.ishwscroll){function m(){var e=l.doc.css(u.trstyle);return!(!e||"matrix"!=e.substr(0,6))&&e.replace(/^.*\((.*)\)$/g,"$1").replace(/px/g,"").split(/, +/)}this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},u.hastranslate3d&&u.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var t=m();if(t)return 16==t.length?-t[13]:-t[5];if(l.timerscroll&&l.timerscroll.bz)return l.timerscroll.bz.getNow()}return l.doc.translate.y},this.getScrollLeft=function(e){if(!e){var t=m();if(t)return 16==t.length?-t[12]:-t[4];if(l.timerscroll&&l.timerscroll.bh)return l.timerscroll.bh.getNow()}return l.doc.translate.x},document.createEvent?this.notifyScrollEvent=function(e){var t=document.createEvent("UIEvents");t.initUIEvent("scroll",!1,!0,window,1),e.dispatchEvent(t)}:document.fireEvent?this.notifyScrollEvent=function(e){var t=document.createEventObject();e.fireEvent("onscroll"),t.cancelBubble=!0}:this.notifyScrollEvent=function(e,t){},u.hastranslate3d&&l.opt.enabletranslate3d?(this.setScrollTop=function(e,t){l.doc.translate.y=e,l.doc.translate.ty=-1*e+"px",l.doc.css(u.trstyle,"translate3d("+l.doc.translate.tx+","+l.doc.translate.ty+",0px)"),t||l.notifyScrollEvent(l.win[0])},this.setScrollLeft=function(e,t){l.doc.translate.x=e,l.doc.translate.tx=-1*e+"px",l.doc.css(u.trstyle,"translate3d("+l.doc.translate.tx+","+l.doc.translate.ty+",0px)"),t||l.notifyScrollEvent(l.win[0])}):(this.setScrollTop=function(e,t){l.doc.translate.y=e,l.doc.translate.ty=-1*e+"px",l.doc.css(u.trstyle,"translate("+l.doc.translate.tx+","+l.doc.translate.ty+")"),t||l.notifyScrollEvent(l.win[0])},this.setScrollLeft=function(e,t){l.doc.translate.x=e,l.doc.translate.tx=-1*e+"px",l.doc.css(u.trstyle,"translate("+l.doc.translate.tx+","+l.doc.translate.ty+")"),t||l.notifyScrollEvent(l.win[0])})}else this.getScrollTop=function(){return l.docscroll.scrollTop()},this.setScrollTop=function(e){return l.docscroll.scrollTop(e)},this.getScrollLeft=function(){return l.docscroll.scrollLeft()},this.setScrollLeft=function(e){return l.docscroll.scrollLeft(e)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,t){if(!e)return!1;for(var o=e.target||e.srcElement||e||!1;o&&o.id!=t;)o=o.parentNode||!1;return!1!==o};var v={thin:1,medium:3,thick:5};function b(e,t,o){var i=e.css(t),n=parseFloat(i);if(isNaN(n)){var r=3==(n=v[i]||0)?o?l.win.outerHeight()-l.win.innerHeight():l.win.outerWidth()-l.win.innerWidth():1;return l.isie8&&n&&(n+=1),r?n:0}return n}function x(e,t,o,i){l._bind(e,t,function(i){var n={original:i=i||window.event,target:i.target||i.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==i.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return i.preventDefault?i.preventDefault():i.returnValue=!1,!1},stopImmediatePropagation:function(){i.stopImmediatePropagation?i.stopImmediatePropagation():i.cancelBubble=!0}};return"mousewheel"==t?(n.deltaY=-.025*i.wheelDelta,i.wheelDeltaX&&(n.deltaX=-.025*i.wheelDeltaX)):n.deltaY=i.detail,o.call(e,n)},i)}function S(e,t,o){var i,n;if(0==e.deltaMode?(i=-Math.floor(e.deltaX*(l.opt.mousescrollstep/54)),n=-Math.floor(e.deltaY*(l.opt.mousescrollstep/54))):1==e.deltaMode&&(i=-Math.floor(e.deltaX*l.opt.mousescrollstep),n=-Math.floor(e.deltaY*l.opt.mousescrollstep)),t&&l.opt.oneaxismousemode&&0==i&&n&&(i=n,n=0),i&&(l.scrollmom&&l.scrollmom.stop(),l.lastdeltax+=i,l.debounced("mousewheelx",function(){var e=l.lastdeltax;l.lastdeltax=0,l.rail.drag||l.doScrollLeftBy(e)},120)),n){if(l.opt.nativeparentscrolling&&o&&!l.ispage&&!l.zoomactive)if(n<0){if(l.getScrollTop()>=l.page.maxh)return!0}else if(l.getScrollTop()<=0)return!0;l.scrollmom&&l.scrollmom.stop(),l.lastdeltay+=n,l.debounced("mousewheely",function(){var e=l.lastdeltay;l.lastdeltay=0,l.rail.drag||l.doScrollBy(e)},120)}return e.stopImmediatePropagation(),e.preventDefault()}this.getOffset=function(){if(l.isfixed)return{top:parseFloat(l.win.css("top")),left:parseFloat(l.win.css("left"))};if(!l.viewport)return l.win.offset();var e=l.win.offset(),t=l.viewport.offset();return{top:e.top-t.top+l.viewport.scrollTop(),left:e.left-t.left+l.viewport.scrollLeft()}},this.updateScrollBar=function(e){if(l.ishwscroll)l.rail.css({height:l.win.innerHeight()}),l.railh&&l.railh.css({width:l.win.innerWidth()});else{var t=l.getOffset();(i={top:t.top,left:t.left}).top+=b(l.win,"border-top-width",!0);l.win.outerWidth(),l.win.innerWidth();i.left+=l.rail.align?l.win.outerWidth()-b(l.win,"border-right-width")-l.rail.width:b(l.win,"border-left-width");var o=l.opt.railoffset;if(o&&(o.top&&(i.top+=o.top),l.rail.align&&o.left&&(i.left+=o.left)),l.locked||l.rail.css({top:i.top,left:i.left,height:e?e.h:l.win.innerHeight()}),l.zoom&&l.zoom.css({top:i.top+1,left:1==l.rail.align?i.left-20:i.left+l.rail.width+4}),l.railh&&!l.locked){var i={top:t.top,left:t.left},n=l.railh.align?i.top+b(l.win,"border-top-width",!0)+l.win.innerHeight()-l.railh.height:i.top+b(l.win,"border-top-width",!0),r=i.left+b(l.win,"border-left-width");l.railh.css({top:n,left:r,width:l.railh.width})}}},this.doRailClick=function(e,t,o){var i,n,r,s;l.locked||(l.cancelEvent(e),t?(i=o?l.doScrollLeft:l.doScrollTop)(r=o?(e.pageX-l.railh.offset().left-l.cursorwidth/2)*l.scrollratio.x:(e.pageY-l.rail.offset().top-l.cursorheight/2)*l.scrollratio.y):(i=o?l.doScrollLeftBy:l.doScrollBy,r=o?l.scroll.x:l.scroll.y,s=o?e.pageX-l.railh.offset().left:e.pageY-l.rail.offset().top,n=o?l.view.w:l.view.h,i(r>=s?n:-n)))},l.hasanimationframe=h,l.hascancelanimationframe=p,l.hasanimationframe?l.hascancelanimationframe||(p=function(){l.cancelAnimationFrame=!0}):(h=function(e){return setTimeout(e,15-Math.floor(+new Date/1e3)%16)},p=clearInterval),this.init=function(){if(l.saved.css=[],u.isie7mobile)return!0;if(u.isoperamini)return!0;if(u.hasmstouch&&l.css(l.ispage?s("html"):l.win,{"-ms-touch-action":"none"}),l.zindex="auto",l.ispage||"auto"!=l.opt.zindex?l.zindex=l.opt.zindex:l.zindex=function(){var e=l.win;if("zIndex"in e)return e.zIndex();for(;e.length>0;){if(9==e[0].nodeType)return!1;var t=e.css("zIndex");if(!isNaN(t)&&0!=t)return parseInt(t);e=e.parent()}return!1}()||"auto",l.ispage||"auto"==l.zindex||l.zindex>r&&(r=l.zindex),l.isie&&0==l.zindex&&"auto"==l.opt.zindex&&(l.zindex="auto"),!l.ispage||!u.cantouch&&!u.isieold&&!u.isie9mobile){var e=l.docscroll;l.ispage&&(e=l.haswrapper?l.win:l.doc),u.isie9mobile||l.css(e,{"overflow-y":"hidden"}),l.ispage&&u.isie7&&("BODY"==l.doc[0].nodeName?l.css(s("html"),{"overflow-y":"hidden"}):"HTML"==l.doc[0].nodeName&&l.css(s("body"),{"overflow-y":"hidden"})),!u.isios||l.ispage||l.haswrapper||l.css(s("body"),{"-webkit-overflow-scrolling":"touch"}),(v=s(document.createElement("div"))).css({position:"relative",top:0,float:"right",width:l.opt.cursorwidth,height:"0px","background-color":l.opt.cursorcolor,border:l.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":l.opt.cursorborderradius,"-moz-border-radius":l.opt.cursorborderradius,"border-radius":l.opt.cursorborderradius}),v.hborder=parseFloat(v.outerHeight()-v.innerHeight()),l.cursor=v;var n=s(document.createElement("div"));n.attr("id",l.id),n.addClass("nicescroll-rails");var a,c,h=["left","right"];for(var p in h)c=h[p],(a=l.opt.railpadding[c])?n.css("padding-"+c,a+"px"):l.opt.railpadding[c]=0;n.append(v),n.width=Math.max(parseFloat(l.opt.cursorwidth),v.outerWidth())+l.opt.railpadding.left+l.opt.railpadding.right,n.css({width:n.width+"px",zIndex:l.zindex,background:l.opt.background,cursor:"default"}),n.visibility=!0,n.scrollable=!0,n.align="left"==l.opt.railalign?0:1,l.rail=n,l.rail.drag=!1;var m=!1;if(!l.opt.boxzoom||l.ispage||u.isieold||(m=document.createElement("div"),l.bind(m,"click",l.doZoom),l.zoom=s(m),l.zoom.css({cursor:"pointer","z-index":l.zindex,backgroundImage:"url("+d+"zoomico.png)",height:18,width:18,backgroundPosition:"0px 0px"}),l.opt.dblclickzoom&&l.bind(l.win,"dblclick",l.doZoom),u.cantouch&&l.opt.gesturezoom&&(l.ongesturezoom=function(e){return e.scale>1.5&&l.doZoomIn(e),e.scale<.8&&l.doZoomOut(e),l.cancelEvent(e)},l.bind(l.win,"gestureend",l.ongesturezoom))),l.railh=!1,l.opt.horizrailenabled){var v;l.css(e,{"overflow-x":"hidden"}),(v=s(document.createElement("div"))).css({position:"relative",top:0,height:l.opt.cursorwidth,width:"0px","background-color":l.opt.cursorcolor,border:l.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":l.opt.cursorborderradius,"-moz-border-radius":l.opt.cursorborderradius,"border-radius":l.opt.cursorborderradius}),v.wborder=parseFloat(v.outerWidth()-v.innerWidth()),l.cursorh=v;var g=s(document.createElement("div"));g.attr("id",l.id+"-hr"),g.addClass("nicescroll-rails"),g.height=Math.max(parseFloat(l.opt.cursorwidth),v.outerHeight()),g.css({height:g.height+"px",zIndex:l.zindex,background:l.opt.background}),g.append(v),g.visibility=!0,g.scrollable=!0,g.align="top"==l.opt.railvalign?0:1,l.railh=g,l.railh.drag=!1}if(l.ispage)n.css({position:"fixed",top:"0px",height:"100%"}),n.align?n.css({right:"0px"}):n.css({left:"0px"}),l.body.append(n),l.railh&&(g.css({position:"fixed",left:"0px",width:"100%"}),g.align?g.css({bottom:"0px"}):g.css({top:"0px"}),l.body.append(g));else{if(l.ishwscroll){"static"==l.win.css("position")&&l.css(l.win,{position:"relative"});var w="HTML"==l.win[0].nodeName?l.body:l.win;l.zoom&&(l.zoom.css({position:"absolute",top:1,right:0,"margin-right":n.width+4}),w.append(l.zoom)),n.css({position:"absolute",top:0}),n.align?n.css({right:0}):n.css({left:0}),w.append(n),g&&(g.css({position:"absolute",left:0,bottom:0}),g.align?g.css({bottom:0}):g.css({top:0}),w.append(g))}else{l.isfixed="fixed"==l.win.css("position");var b=l.isfixed?"fixed":"absolute";l.isfixed||(l.viewport=l.getViewport(l.win[0])),l.viewport&&(l.body=l.viewport,0==/relative|absolute/.test(l.viewport.css("position"))&&l.css(l.viewport,{position:"relative"})),n.css({position:b}),l.zoom&&l.zoom.css({position:b}),l.updateScrollBar(),l.body.append(n),l.zoom&&l.body.append(l.zoom),l.railh&&(g.css({position:b}),l.body.append(g))}u.isios&&l.css(l.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),u.isie&&l.opt.disableoutline&&l.win.attr("hideFocus","true"),u.iswebkit&&l.opt.disableoutline&&l.win.css({outline:"none"})}if(!1===l.opt.autohidemode?(l.autohidedom=!1,l.rail.css({opacity:l.opt.cursoropacitymax}),l.railh&&l.railh.css({opacity:l.opt.cursoropacitymax})):!0===l.opt.autohidemode?(l.autohidedom=s().add(l.rail),u.isie8&&(l.autohidedom=l.autohidedom.add(l.cursor)),l.railh&&(l.autohidedom=l.autohidedom.add(l.railh)),l.railh&&u.isie8&&(l.autohidedom=l.autohidedom.add(l.cursorh))):"scroll"==l.opt.autohidemode?(l.autohidedom=s().add(l.rail),l.railh&&(l.autohidedom=l.autohidedom.add(l.railh))):"cursor"==l.opt.autohidemode?(l.autohidedom=s().add(l.cursor),l.railh&&(l.autohidedom=l.autohidedom.add(l.cursorh))):"hidden"==l.opt.autohidemode&&(l.autohidedom=!1,l.hide(),l.locked=!1),u.isie9mobile){l.scrollmom=new y(l),l.onmangotouch=function(e){var t=l.getScrollTop(),o=l.getScrollLeft();if(t==l.scrollmom.lastscrolly&&o==l.scrollmom.lastscrollx)return!0;var i=t-l.mangotouch.sy,n=o-l.mangotouch.sx;if(0!=Math.round(Math.sqrt(Math.pow(n,2)+Math.pow(i,2)))){var r=i<0?-1:1,s=n<0?-1:1,a=+new Date;if(l.mangotouch.lazy&&clearTimeout(l.mangotouch.lazy),a-l.mangotouch.tm>80||l.mangotouch.dry!=r||l.mangotouch.drx!=s)l.scrollmom.stop(),l.scrollmom.reset(o,t),l.mangotouch.sy=t,l.mangotouch.ly=t,l.mangotouch.sx=o,l.mangotouch.lx=o,l.mangotouch.dry=r,l.mangotouch.drx=s,l.mangotouch.tm=a;else{l.scrollmom.stop(),l.scrollmom.update(l.mangotouch.sx-n,l.mangotouch.sy-i);l.mangotouch.tm;l.mangotouch.tm=a;var c=Math.max(Math.abs(l.mangotouch.ly-t),Math.abs(l.mangotouch.lx-o));l.mangotouch.ly=t,l.mangotouch.lx=o,c>2&&(l.mangotouch.lazy=setTimeout(function(){l.mangotouch.lazy=!1,l.mangotouch.dry=0,l.mangotouch.drx=0,l.mangotouch.tm=0,l.scrollmom.doMomentum(30)},100))}}};var x=l.getScrollTop(),S=l.getScrollLeft();l.mangotouch={sy:x,ly:x,dry:0,sx:S,lx:S,drx:0,lazy:!1,tm:0},l.bind(l.docscroll,"scroll",l.onmangotouch)}else{if(u.cantouch||l.istouchcapable||l.opt.touchbehavior||u.hasmstouch){l.scrollmom=new y(l),l.ontouchstart=function(e){if(e.pointerType&&2!=e.pointerType)return!1;if(!l.locked){if(u.hasmstouch)for(var t=!!e.target&&e.target;t;){var o=s(t).getNiceScroll();if(o.length>0&&o[0].me==l.me)break;if(o.length>0)return!1;if("DIV"==t.nodeName&&t.id==l.id)break;t=!!t.parentNode&&t.parentNode}if(l.cancelScroll(),t=l.getTarget(e))if(/INPUT/i.test(t.nodeName)&&/range/i.test(t.type))return l.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),l.forcescreen){var i=e;(e={original:e.original?e.original:e}).clientX=i.screenX,e.clientY=i.screenY}if(l.rail.drag={x:e.clientX,y:e.clientY,sx:l.scroll.x,sy:l.scroll.y,st:l.getScrollTop(),sl:l.getScrollLeft(),pt:2,dl:!1},l.ispage||!l.opt.directionlockdeadzone)l.rail.drag.dl="f";else{var n={w:s(window).width(),h:s(window).height()},r={w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},a=Math.max(0,r.h-n.h),c=Math.max(0,r.w-n.w);!l.rail.scrollable&&l.railh.scrollable?l.rail.drag.ck=a>0&&"v":l.rail.scrollable&&!l.railh.scrollable?l.rail.drag.ck=c>0&&"h":l.rail.drag.ck=!1,l.rail.drag.ck||(l.rail.drag.dl="f")}if(l.opt.touchbehavior&&l.isiframe&&u.isie){var d=l.win.position();l.rail.drag.x+=d.left,l.rail.drag.y+=d.top}if(l.hasmoving=!1,l.lastmouseup=!1,l.scrollmom.reset(e.clientX,e.clientY),!u.cantouch&&!this.istouchcapable&&!u.hasmstouch){if(!(!!t&&/INPUT|SELECT|TEXTAREA/i.test(t.nodeName)))return!l.ispage&&u.hasmousecapture&&t.setCapture(),l.opt.touchbehavior?l.cancelEvent(e):l.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(s(t).attr("type"))&&(pc={tg:t,click:!1},l.preventclick=pc)}}},l.ontouchend=function(e){return(!e.pointerType||2==e.pointerType)&&(l.rail.drag&&2==l.rail.drag.pt&&(l.scrollmom.doMomentum(),l.rail.drag=!1,l.hasmoving&&(l.hasmoving=!1,l.lastmouseup=!0,l.hideCursor(),u.hasmousecapture&&document.releaseCapture(),!u.cantouch))?l.cancelEvent(e):void 0)};var T=l.opt.touchbehavior&&l.isiframe&&!u.hasmousecapture;l.ontouchmove=function(e,t){if(e.pointerType&&2!=e.pointerType)return!1;if(l.rail.drag&&2==l.rail.drag.pt){if(u.cantouch&&void 0===e.original)return!0;if(l.hasmoving=!0,l.preventclick&&!l.preventclick.click&&(l.preventclick.click=l.preventclick.tg.onclick||!1,l.preventclick.tg.onclick=l.onpreventclick),"changedTouches"in(e=s.extend({original:e},e))&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),l.forcescreen){var o=e;(e={original:e.original?e.original:e}).clientX=o.screenX,e.clientY=o.screenY}var i=ofy=0;if(T&&!t){var n=l.win.position();i=-n.left,ofy=-n.top}var r=e.clientY+ofy,a=r-l.rail.drag.y,c=e.clientX+i,d=c-l.rail.drag.x,h=l.rail.drag.st-a;if(l.ishwscroll&&l.opt.bouncescroll?h<0?h=Math.round(h/2):h>l.page.maxh&&(h=l.page.maxh+Math.round((h-l.page.maxh)/2)):(h<0&&(h=0,r=0),h>l.page.maxh&&(h=l.page.maxh,r=0)),l.railh&&l.railh.scrollable){var p=l.rail.drag.sl-d;l.ishwscroll&&l.opt.bouncescroll?p<0?p=Math.round(p/2):p>l.page.maxw&&(p=l.page.maxw+Math.round((p-l.page.maxw)/2)):(p<0&&(p=0,c=0),p>l.page.maxw&&(p=l.page.maxw,c=0))}var m=!1;if(l.rail.drag.dl)m=!0,"v"==l.rail.drag.dl?p=l.rail.drag.sl:"h"==l.rail.drag.dl&&(h=l.rail.drag.st);else{var v=Math.abs(a),f=Math.abs(d),g=l.opt.directionlockdeadzone;if("v"==l.rail.drag.ck){if(v>g&&f<=.3*v)return l.rail.drag=!1,!0;f>g&&(l.rail.drag.dl="f",s("body").scrollTop(s("body").scrollTop()))}else if("h"==l.rail.drag.ck){if(f>g&&v<=.3*f)return l.rail.drag=!1,!0;v>g&&(l.rail.drag.dl="f",s("body").scrollLeft(s("body").scrollLeft()))}}if(l.synched("touchmove",function(){l.rail.drag&&2==l.rail.drag.pt&&(l.prepareTransition&&l.prepareTransition(0),l.rail.scrollable&&l.setScrollTop(h),l.scrollmom.update(c,r),l.railh&&l.railh.scrollable?(l.setScrollLeft(p),l.showCursor(h,p)):l.showCursor(h),u.isie10&&document.selection.clear())}),u.ischrome&&l.istouchcapable&&(m=!1),m)return l.cancelEvent(e)}}}if(l.onmousedown=function(e,t){if(!l.rail.drag||1==l.rail.drag.pt){if(l.locked)return l.cancelEvent(e);l.cancelScroll(),l.rail.drag={x:e.clientX,y:e.clientY,sx:l.scroll.x,sy:l.scroll.y,pt:1,hr:!!t};var o=l.getTarget(e);return!l.ispage&&u.hasmousecapture&&o.setCapture(),l.isiframe&&!u.hasmousecapture&&(l.saved.csspointerevents=l.doc.css("pointer-events"),l.css(l.doc,{"pointer-events":"none"})),l.cancelEvent(e)}},l.onmouseup=function(e){if(l.rail.drag){if(u.hasmousecapture&&document.releaseCapture(),l.isiframe&&!u.hasmousecapture&&l.doc.css("pointer-events",l.saved.csspointerevents),1!=l.rail.drag.pt)return;return l.rail.drag=!1,l.cancelEvent(e)}},l.onmousemove=function(e){if(l.rail.drag){if(1!=l.rail.drag.pt)return;if(u.ischrome&&0==e.which)return l.onmouseup(e);if(l.cursorfreezed=!0,l.rail.drag.hr){l.scroll.x=l.rail.drag.sx+(e.clientX-l.rail.drag.x),l.scroll.x<0&&(l.scroll.x=0);var t=l.scrollvaluemaxw;l.scroll.x>t&&(l.scroll.x=t)}else{l.scroll.y=l.rail.drag.sy+(e.clientY-l.rail.drag.y),l.scroll.y<0&&(l.scroll.y=0);var o=l.scrollvaluemax;l.scroll.y>o&&(l.scroll.y=o)}return l.synched("mousemove",function(){l.rail.drag&&1==l.rail.drag.pt&&(l.showCursor(),l.rail.drag.hr?l.doScrollLeft(Math.round(l.scroll.x*l.scrollratio.x),l.opt.cursordragspeed):l.doScrollTop(Math.round(l.scroll.y*l.scrollratio.y),l.opt.cursordragspeed))}),l.cancelEvent(e)}},u.cantouch||l.opt.touchbehavior)l.onpreventclick=function(e){if(l.preventclick)return l.preventclick.tg.onclick=l.preventclick.click,l.preventclick=!1,l.cancelEvent(e)},l.bind(l.win,"mousedown",l.ontouchstart),l.onclick=!u.isios&&function(e){return!l.lastmouseup||(l.lastmouseup=!1,l.cancelEvent(e))},l.opt.grabcursorenabled&&u.cursorgrabvalue&&(l.css(l.ispage?l.doc:l.win,{cursor:u.cursorgrabvalue}),l.css(l.rail,{cursor:u.cursorgrabvalue}));else{"getSelection"in document?l.hasTextSelected=function(){return document.getSelection().rangeCount>0}:"selection"in document?l.hasTextSelected=function(){return"None"!=document.selection.type}:l.hasTextSelected=function(){return!1},l.onselectionstart=function(e){l.ispage||(l.selectiondrag=l.win.offset())},l.onselectionend=function(e){l.selectiondrag=!1},l.onselectiondrag=function(e){l.selectiondrag&&l.hasTextSelected()&&l.debounced("selectionscroll",function(){!function e(t){if(l.selectiondrag){if(t){var o=l.win.outerHeight(),i=t.pageY-l.selectiondrag.top;i>0&&i<o&&(i=0),i>=o&&(i-=o),l.selectiondrag.df=i}if(0!=l.selectiondrag.df){var n=2*-Math.floor(l.selectiondrag.df/6);l.doScrollBy(n),l.debounced("doselectionscroll",function(){e()},50)}}}(e)},250)}}u.hasmstouch&&(l.css(l.rail,{"-ms-touch-action":"none"}),l.css(l.cursor,{"-ms-touch-action":"none"}),l.bind(l.win,"MSPointerDown",l.ontouchstart),l.bind(document,"MSPointerUp",l.ontouchend),l.bind(document,"MSPointerMove",l.ontouchmove),l.bind(l.cursor,"MSGestureHold",function(e){e.preventDefault()}),l.bind(l.cursor,"contextmenu",function(e){e.preventDefault()})),this.istouchcapable&&(l.bind(l.win,"touchstart",l.ontouchstart),l.bind(document,"touchend",l.ontouchend),l.bind(document,"touchcancel",l.ontouchend),l.bind(document,"touchmove",l.ontouchmove)),l.bind(l.cursor,"mousedown",l.onmousedown),l.bind(l.cursor,"mouseup",l.onmouseup),l.railh&&(l.bind(l.cursorh,"mousedown",function(e){l.onmousedown(e,!0)}),l.bind(l.cursorh,"mouseup",function(e){if(!l.rail.drag||2!=l.rail.drag.pt)return l.rail.drag=!1,l.hasmoving=!1,l.hideCursor(),u.hasmousecapture&&document.releaseCapture(),l.cancelEvent(e)})),(l.opt.cursordragontouch||!u.cantouch&&!l.opt.touchbehavior)&&(l.rail.css({cursor:"default"}),l.railh&&l.railh.css({cursor:"default"}),l.jqbind(l.rail,"mouseenter",function(){l.canshowonmouseevent&&l.showCursor(),l.rail.active=!0}),l.jqbind(l.rail,"mouseleave",function(){l.rail.active=!1,l.rail.drag||l.hideCursor()}),l.opt.sensitiverail&&(l.bind(l.rail,"click",function(e){l.doRailClick(e,!1,!1)}),l.bind(l.rail,"dblclick",function(e){l.doRailClick(e,!0,!1)}),l.bind(l.cursor,"click",function(e){l.cancelEvent(e)}),l.bind(l.cursor,"dblclick",function(e){l.cancelEvent(e)})),l.railh&&(l.jqbind(l.railh,"mouseenter",function(){l.canshowonmouseevent&&l.showCursor(),l.rail.active=!0}),l.jqbind(l.railh,"mouseleave",function(){l.rail.active=!1,l.rail.drag||l.hideCursor()}),l.opt.sensitiverail&&(l.bind(l.railh,"click",function(e){l.doRailClick(e,!1,!0)}),l.bind(l.railh,"dblclick",function(e){l.doRailClick(e,!0,!0)}),l.bind(l.cursorh,"click",function(e){l.cancelEvent(e)}),l.bind(l.cursorh,"dblclick",function(e){l.cancelEvent(e)})))),u.cantouch||l.opt.touchbehavior?(l.bind(u.hasmousecapture?l.win:document,"mouseup",l.ontouchend),l.bind(document,"mousemove",l.ontouchmove),l.onclick&&l.bind(document,"click",l.onclick),l.opt.cursordragontouch&&(l.bind(l.cursor,"mousedown",l.onmousedown),l.bind(l.cursor,"mousemove",l.onmousemove),l.cursorh&&l.bind(l.cursorh,"mousedown",l.onmousedown),l.cursorh&&l.bind(l.cursorh,"mousemove",l.onmousemove))):(l.bind(u.hasmousecapture?l.win:document,"mouseup",l.onmouseup),l.bind(document,"mousemove",l.onmousemove),l.onclick&&l.bind(document,"click",l.onclick),!l.ispage&&l.opt.enablescrollonselection&&(l.bind(l.win[0],"mousedown",l.onselectionstart),l.bind(document,"mouseup",l.onselectionend),l.bind(l.cursor,"mouseup",l.onselectionend),l.cursorh&&l.bind(l.cursorh,"mouseup",l.onselectionend),l.bind(document,"mousemove",l.onselectiondrag)),l.zoom&&(l.jqbind(l.zoom,"mouseenter",function(){l.canshowonmouseevent&&l.showCursor(),l.rail.active=!0}),l.jqbind(l.zoom,"mouseleave",function(){l.rail.active=!1,l.rail.drag||l.hideCursor()}))),l.opt.enablemousewheel&&(l.isiframe||l.bind(u.isie&&l.ispage?document:l.win,"mousewheel",l.onmousewheel),l.bind(l.rail,"mousewheel",l.onmousewheel),l.railh&&l.bind(l.railh,"mousewheel",l.onmousewheelhr)),l.ispage||u.cantouch||/HTML|BODY/.test(l.win[0].nodeName)||(l.win.attr("tabindex")||l.win.attr({tabindex:i++}),l.jqbind(l.win,"focus",function(e){t=l.getTarget(e).id||!0,l.hasfocus=!0,l.canshowonmouseevent&&l.noticeCursor()}),l.jqbind(l.win,"blur",function(e){t=!1,l.hasfocus=!1}),l.jqbind(l.win,"mouseenter",function(e){o=l.getTarget(e).id||!0,l.hasmousefocus=!0,l.canshowonmouseevent&&l.noticeCursor()}),l.jqbind(l.win,"mouseleave",function(){o=!1,l.hasmousefocus=!1}))}if(l.onkeypress=function(e){if(l.locked&&0==l.page.maxh)return!0;e=e||window.e;var i=l.getTarget(e);if(i&&/INPUT|TEXTAREA|SELECT|OPTION/.test(i.nodeName)&&(!(i.getAttribute("type")||i.type||!1)||!/submit|button|cancel/i.tp))return!0;if(l.hasfocus||l.hasmousefocus&&!t||l.ispage&&!t&&!o){var n=e.keyCode;if(l.locked&&27!=n)return l.cancelEvent(e);var r=e.ctrlKey||!1,s=e.shiftKey||!1,a=!1;switch(n){case 38:case 63233:l.doScrollBy(72),a=!0;break;case 40:case 63235:l.doScrollBy(-72),a=!0;break;case 37:case 63232:l.railh&&(r?l.doScrollLeft(0):l.doScrollLeftBy(72),a=!0);break;case 39:case 63234:l.railh&&(r?l.doScrollLeft(l.page.maxw):l.doScrollLeftBy(-72),a=!0);break;case 33:case 63276:l.doScrollBy(l.view.h),a=!0;break;case 34:case 63277:l.doScrollBy(-l.view.h),a=!0;break;case 36:case 63273:l.railh&&r?l.doScrollPos(0,0):l.doScrollTo(0),a=!0;break;case 35:case 63275:l.railh&&r?l.doScrollPos(l.page.maxw,l.page.maxh):l.doScrollTo(l.page.maxh),a=!0;break;case 32:l.opt.spacebarenabled&&(s?l.doScrollBy(l.view.h):l.doScrollBy(-l.view.h),a=!0);break;case 27:l.zoomactive&&(l.doZoom(),a=!0)}if(a)return l.cancelEvent(e)}},l.opt.enablekeyboard&&l.bind(document,u.isopera&&!u.isopera12?"keypress":"keydown",l.onkeypress),l.bind(window,"resize",l.lazyResize),l.bind(window,"orientationchange",l.lazyResize),l.bind(window,"load",l.lazyResize),u.ischrome&&!l.ispage&&!l.haswrapper){var C=l.win.attr("style"),z=parseFloat(l.win.css("width"))+1;l.win.css("width",z),l.synched("chromefix",function(){l.win.attr("style",C)})}l.onAttributeChange=function(e){l.lazyResize(250)},l.ispage||l.haswrapper||(!1!==f?(l.observer=new f(function(e){e.forEach(l.onAttributeChange)}),l.observer.observe(l.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),l.observerremover=new f(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var t in e.removedNodes)if(e.removedNodes[t]==l.win[0])return l.remove()})}),l.observerremover.observe(l.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(l.bind(l.win,u.isie&&!u.isie9?"propertychange":"DOMAttrModified",l.onAttributeChange),u.isie9&&l.win[0].attachEvent("onpropertychange",l.onAttributeChange),l.bind(l.win,"DOMNodeRemoved",function(e){e.target==l.win[0]&&l.remove()}))),!l.ispage&&l.opt.boxzoom&&l.bind(window,"resize",l.resizeZoom),l.istextarea&&l.bind(l.win,"mouseup",l.lazyResize),l.checkrtlmode=!0,l.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){function k(e){l.iframexd=!1;try{var t="contentDocument"in this?this.contentDocument:this.contentWindow.document;t.domain}catch(e){l.iframexd=!0,t=!1}if(l.iframexd)return"console"in window&&console.log("NiceScroll error: policy restriced iframe"),!0;if(l.forcescreen=!0,l.isiframe&&(l.iframe={doc:s(t),html:l.doc.contents().find("html")[0],body:l.doc.contents().find("body")[0]},l.getContentSize=function(){return{w:Math.max(l.iframe.html.scrollWidth,l.iframe.body.scrollWidth),h:Math.max(l.iframe.html.scrollHeight,l.iframe.body.scrollHeight)}},l.docscroll=s(l.iframe.body)),!u.isios&&l.opt.iframeautoresize&&!l.isiframe){l.win.scrollTop(0),l.doc.height("");var o=Math.max(t.getElementsByTagName("html")[0].scrollHeight,t.body.scrollHeight);l.doc.height(o)}l.lazyResize(30),u.isie7&&l.css(s(l.iframe.html),{"overflow-y":"hidden"}),l.css(s(l.iframe.body),{"overflow-y":"hidden"}),u.isios&&l.haswrapper&&(l.css(s(t.body),{"-webkit-transform":"translate3d(0,0,0)"}),console.log(1)),"contentWindow"in this?l.bind(this.contentWindow,"scroll",l.onscroll):l.bind(t,"scroll",l.onscroll),l.opt.enablemousewheel&&l.bind(t,"mousewheel",l.onmousewheel),l.opt.enablekeyboard&&l.bind(t,u.isopera?"keypress":"keydown",l.onkeypress),(u.cantouch||l.opt.touchbehavior)&&(l.bind(t,"mousedown",l.ontouchstart),l.bind(t,"mousemove",function(e){l.ontouchmove(e,!0)}),l.opt.grabcursorenabled&&u.cursorgrabvalue&&l.css(s(t.body),{cursor:u.cursorgrabvalue})),l.bind(t,"mouseup",l.ontouchend),l.zoom&&(l.opt.dblclickzoom&&l.bind(t,"dblclick",l.doZoom),l.ongesturezoom&&l.bind(t,"gestureend",l.ongesturezoom))}this.doc[0].readyState&&"complete"==this.doc[0].readyState&&setTimeout(function(){k.call(l.doc[0],!1)},500),l.bind(this.doc,"load",k)}},this.showCursor=function(e,t){l.cursortimeout&&(clearTimeout(l.cursortimeout),l.cursortimeout=0),l.rail&&(l.autohidedom&&(l.autohidedom.stop().css({opacity:l.opt.cursoropacitymax}),l.cursoractive=!0),l.rail.drag&&1==l.rail.drag.pt||(void 0!==e&&!1!==e&&(l.scroll.y=Math.round(1*e/l.scrollratio.y)),void 0!==t&&(l.scroll.x=Math.round(1*t/l.scrollratio.x))),l.cursor.css({height:l.cursorheight,top:l.scroll.y}),l.cursorh&&(!l.rail.align&&l.rail.visibility?l.cursorh.css({width:l.cursorwidth,left:l.scroll.x+l.rail.width}):l.cursorh.css({width:l.cursorwidth,left:l.scroll.x}),l.cursoractive=!0),l.zoom&&l.zoom.stop().css({opacity:l.opt.cursoropacitymax}))},this.hideCursor=function(e){l.cursortimeout||l.rail&&l.autohidedom&&(l.cursortimeout=setTimeout(function(){l.rail.active&&l.showonmouseevent||(l.autohidedom.stop().animate({opacity:l.opt.cursoropacitymin}),l.zoom&&l.zoom.stop().animate({opacity:l.opt.cursoropacitymin}),l.cursoractive=!1),l.cursortimeout=0},e||l.opt.hidecursordelay))},this.noticeCursor=function(e,t,o){l.showCursor(t,o),l.rail.active||l.hideCursor(e)},this.getContentSize=l.ispage?function(){return{w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}}:l.haswrapper?function(){return{w:l.doc.outerWidth()+parseInt(l.win.css("paddingLeft"))+parseInt(l.win.css("paddingRight")),h:l.doc.outerHeight()+parseInt(l.win.css("paddingTop"))+parseInt(l.win.css("paddingBottom"))}}:function(){return{w:l.docscroll[0].scrollWidth,h:l.docscroll[0].scrollHeight}},this.onResize=function(e,t){if(!l.win)return!1;if(!l.haswrapper&&!l.ispage){if("none"==l.win.css("display"))return l.visibility&&l.hideRail().hideRailHr(),!1;l.hidden||l.visibility||l.showRail().showRailHr()}var o=l.page.maxh,i=l.page.maxw,n=(l.view.h,l.view.w);if(l.view={w:l.ispage?l.win.width():parseInt(l.win[0].clientWidth),h:l.ispage?l.win.height():parseInt(l.win[0].clientHeight)},l.page=t||l.getContentSize(),l.page.maxh=Math.max(0,l.page.h-l.view.h),l.page.maxw=Math.max(0,l.page.w-l.view.w),l.page.maxh==o&&l.page.maxw==i&&l.view.w==n){if(l.ispage)return l;var r=l.win.offset();if(l.lastposition){var s=l.lastposition;if(s.top==r.top&&s.left==r.left)return l}l.lastposition=r}return 0==l.page.maxh?(l.hideRail(),l.scrollvaluemax=0,l.scroll.y=0,l.scrollratio.y=0,l.cursorheight=0,l.setScrollTop(0),l.rail.scrollable=!1):l.rail.scrollable=!0,0==l.page.maxw?(l.hideRailHr(),l.scrollvaluemaxw=0,l.scroll.x=0,l.scrollratio.x=0,l.cursorwidth=0,l.setScrollLeft(0),l.railh.scrollable=!1):l.railh.scrollable=!0,l.locked=0==l.page.maxh&&0==l.page.maxw,l.locked?(l.ispage||l.updateScrollBar(l.view),!1):(l.hidden||l.visibility?l.hidden||l.railh.visibility||l.showRailHr():l.showRail().showRailHr(),l.istextarea&&l.win.css("resize")&&"none"!=l.win.css("resize")&&(l.view.h-=20),l.cursorheight=Math.min(l.view.h,Math.round(l.view.h*(l.view.h/l.page.h))),l.cursorheight=l.opt.cursorfixedheight?l.opt.cursorfixedheight:Math.max(l.opt.cursorminheight,l.cursorheight),l.cursorwidth=Math.min(l.view.w,Math.round(l.view.w*(l.view.w/l.page.w))),l.cursorwidth=l.opt.cursorfixedheight?l.opt.cursorfixedheight:Math.max(l.opt.cursorminheight,l.cursorwidth),l.scrollvaluemax=l.view.h-l.cursorheight-l.cursor.hborder,l.railh&&(l.railh.width=l.page.maxh>0?l.view.w-l.rail.width:l.view.w,l.scrollvaluemaxw=l.railh.width-l.cursorwidth-l.cursorh.wborder),l.checkrtlmode&&l.railh&&(l.checkrtlmode=!1,l.opt.rtlmode&&0==l.scroll.x&&l.setScrollLeft(l.page.maxw)),l.ispage||l.updateScrollBar(l.view),l.scrollratio={x:l.page.maxw/l.scrollvaluemaxw,y:l.page.maxh/l.scrollvaluemax},l.getScrollTop()>l.page.maxh?l.doScrollTop(l.page.maxh):(l.scroll.y=Math.round(l.getScrollTop()*(1/l.scrollratio.y)),l.scroll.x=Math.round(l.getScrollLeft()*(1/l.scrollratio.x)),l.cursoractive&&l.noticeCursor()),l.scroll.y&&0==l.getScrollTop()&&l.doScrollTo(Math.floor(l.scroll.y*l.scrollratio.y)),l)},this.resize=l.onResize,this.lazyResize=function(e){return e=isNaN(e)?30:e,l.delayed("resize",l.resize,e),l},this._bind=function(e,t,o,i){l.events.push({e:e,n:t,f:o,b:i,q:!1}),e.addEventListener?e.addEventListener(t,o,i||!1):e.attachEvent?e.attachEvent("on"+t,o):e["on"+t]=o},this.jqbind=function(e,t,o){l.events.push({e:e,n:t,f:o,q:!0}),s(e).bind(t,o)},this.bind=function(e,t,o,i){var n="jquery"in e?e[0]:e;if("mousewheel"==t)if("onwheel"in l.win)l._bind(n,"wheel",o,i||!1);else{var r=void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll";x(n,r,o,i||!1),"DOMMouseScroll"==r&&x(n,"MozMousePixelScroll",o,i||!1)}else if(n.addEventListener){if(u.cantouch&&/mouseup|mousedown|mousemove/.test(t)){var s="mousedown"==t?"touchstart":"mouseup"==t?"touchend":"touchmove";l._bind(n,s,function(e){if(e.touches)e.touches.length<2&&((t=e.touches.length?e.touches[0]:e).original=e,o.call(this,t));else if(e.changedTouches){var t;(t=e.changedTouches[0]).original=e,o.call(this,t)}},i||!1)}l._bind(n,t,o,i||!1),u.cantouch&&"mouseup"==t&&l._bind(n,"touchcancel",o,i||!1)}else l._bind(n,t,function(e){return(e=e||window.event||!1)&&e.srcElement&&(e.target=e.srcElement),"pageY"in e||(e.pageX=e.clientX+document.documentElement.scrollLeft,e.pageY=e.clientY+document.documentElement.scrollTop),!1!==o.call(n,e)&&!1!==i||l.cancelEvent(e)})},this._unbind=function(e,t,o,i){e.removeEventListener?e.removeEventListener(t,o,i):e.detachEvent?e.detachEvent("on"+t,o):e["on"+t]=!1},this.unbindAll=function(){for(var e=0;e<l.events.length;e++){var t=l.events[e];t.q?t.e.unbind(t.n,t.f):l._unbind(t.e,t.n,t.f,t.b)}},this.cancelEvent=function(e){return!!(e=e.original?e.original:e||(window.event||!1))&&(e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return!!(e=e.original?e.original:e||(window.event||!1))&&(e.stopPropagation?e.stopPropagation():(e.cancelBubble&&(e.cancelBubble=!0),!1))},this.showRail=function(){return 0==l.page.maxh||!l.ispage&&"none"==l.win.css("display")||(l.visibility=!0,l.rail.visibility=!0,l.rail.css("display","block")),l},this.showRailHr=function(){return l.railh?(0==l.page.maxw||!l.ispage&&"none"==l.win.css("display")||(l.railh.visibility=!0,l.railh.css("display","block")),l):l},this.hideRail=function(){return l.visibility=!1,l.rail.visibility=!1,l.rail.css("display","none"),l},this.hideRailHr=function(){return l.railh?(l.railh.visibility=!1,l.railh.css("display","none"),l):l},this.show=function(){return l.hidden=!1,l.locked=!1,l.showRail().showRailHr()},this.hide=function(){return l.hidden=!0,l.locked=!0,l.hideRail().hideRailHr()},this.toggle=function(){return l.hidden?l.show():l.hide()},this.remove=function(){l.stop(),l.cursortimeout&&clearTimeout(l.cursortimeout),l.doZoomOut(),l.unbindAll(),u.isie9&&l.win[0].detachEvent("onpropertychange",l.onAttributeChange),!1!==l.observer&&l.observer.disconnect(),!1!==l.observerremover&&l.observerremover.disconnect(),l.events=null,l.cursor&&l.cursor.remove(),l.cursorh&&l.cursorh.remove(),l.rail&&l.rail.remove(),l.railh&&l.railh.remove(),l.zoom&&l.zoom.remove();for(var e=0;e<l.saved.css.length;e++){var t=l.saved.css[e];t[0].css(t[1],void 0===t[2]?"":t[2])}l.saved=!1,l.me.data("__nicescroll","");var o=s.nicescroll;for(var i in o.each(function(e){if(this&&this.id===l.id){delete o[e];for(var t=++e;t<o.length;t++,e++)o[e]=o[t];o.length--,o.length&&delete o[o.length]}}),l)l[i]=null,delete l[i];l=null},this.scrollstart=function(e){return this.onscrollstart=e,l},this.scrollend=function(e){return this.onscrollend=e,l},this.scrollcancel=function(e){return this.onscrollcancel=e,l},this.zoomin=function(e){return this.onzoomin=e,l},this.zoomout=function(e){return this.onzoomout=e,l},this.isScrollable=function(e){var t=e.target?e.target:e;if("OPTION"==t.nodeName)return!0;for(;t&&1==t.nodeType&&!/BODY|HTML/.test(t.nodeName);){var o=s(t),i=o.css("overflowY")||o.css("overflowX")||o.css("overflow")||"";if(/scroll|auto/.test(i))return t.clientHeight!=t.scrollHeight;t=!!t.parentNode&&t.parentNode}return!1},this.getViewport=function(e){for(var t=!(!e||!e.parentNode)&&e.parentNode;t&&1==t.nodeType&&!/BODY|HTML/.test(t.nodeName);){var o=s(t),i=o.css("overflowY")||o.css("overflowX")||o.css("overflow")||"";if(/scroll|auto/.test(i)&&t.clientHeight!=t.scrollHeight)return o;if(o.getNiceScroll().length>0)return o;t=!!t.parentNode&&t.parentNode}return!1},this.onmousewheel=function(e){if(l.locked)return l.debounced("checkunlock",l.resize,250),!0;if(l.rail.drag)return l.cancelEvent(e);if("auto"==l.opt.oneaxismousemode&&0!=e.deltaX&&(l.opt.oneaxismousemode=!1),l.opt.oneaxismousemode&&0==e.deltaX&&!l.rail.scrollable)return!l.railh||!l.railh.scrollable||l.onmousewheelhr(e);var t=+new Date,o=!1;if(l.opt.preservenativescrolling&&l.checkarea+600<t&&(l.nativescrollingarea=l.isScrollable(e),o=!0),l.checkarea=t,l.nativescrollingarea)return!0;var i=S(e,!1,o);return i&&(l.checkarea=0),i},this.onmousewheelhr=function(e){if(l.locked||!l.railh.scrollable)return!0;if(l.rail.drag)return l.cancelEvent(e);var t=+new Date,o=!1;return l.opt.preservenativescrolling&&l.checkarea+600<t&&(l.nativescrollingarea=l.isScrollable(e),o=!0),l.checkarea=t,!!l.nativescrollingarea||(l.locked?l.cancelEvent(e):S(e,!0,o))},this.stop=function(){return l.cancelScroll(),l.scrollmon&&l.scrollmon.stop(),l.cursorfreezed=!1,l.scroll.y=Math.round(l.getScrollTop()*(1/l.scrollratio.y)),l.noticeCursor(),l},this.getTransitionSpeed=function(e){var t=Math.round(10*l.opt.scrollspeed),o=Math.min(t,Math.round(e/20*l.opt.scrollspeed));return o>20?o:0},l.opt.smoothscroll?l.ishwscroll&&u.hastransition&&l.opt.usetransition?(this.prepareTransition=function(e,t){var o=t?e>20?e:0:l.getTransitionSpeed(e),i=o?u.prefixstyle+"transform "+o+"ms ease-out":"";return l.lasttransitionstyle&&l.lasttransitionstyle==i||(l.lasttransitionstyle=i,l.doc.css(u.transitionstyle,i)),o},this.doScrollLeft=function(e,t){var o=l.scrollrunning?l.newscrolly:l.getScrollTop();l.doScrollPos(e,o,t)},this.doScrollTop=function(e,t){var o=l.scrollrunning?l.newscrollx:l.getScrollLeft();l.doScrollPos(o,e,t)},this.doScrollPos=function(e,t,o){var i=l.getScrollTop(),n=l.getScrollLeft();return((l.newscrolly-i)*(t-i)<0||(l.newscrollx-n)*(e-n)<0)&&l.cancelScroll(),0==l.opt.bouncescroll&&(t<0?t=0:t>l.page.maxh&&(t=l.page.maxh),e<0?e=0:e>l.page.maxw&&(e=l.page.maxw)),(!l.scrollrunning||e!=l.newscrollx||t!=l.newscrolly)&&(l.newscrolly=t,l.newscrollx=e,l.newscrollspeed=o||!1,!l.timer&&void(l.timer=setTimeout(function(){var o=l.getScrollTop(),i=l.getScrollLeft(),n={};n.x=e-i,n.y=t-o,n.px=i,n.py=o;var r=Math.round(Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))),s=l.newscrollspeed&&l.newscrollspeed>1?l.newscrollspeed:l.getTransitionSpeed(r);if(l.newscrollspeed&&l.newscrollspeed<=1&&(s*=l.newscrollspeed),l.prepareTransition(s,!0),l.timerscroll&&l.timerscroll.tm&&clearInterval(l.timerscroll.tm),s>0){if(!l.scrollrunning&&l.onscrollstart){var a={type:"scrollstart",current:{x:i,y:o},request:{x:e,y:t},end:{x:l.newscrollx,y:l.newscrolly},speed:s};l.onscrollstart.call(l,a)}u.transitionend?l.scrollendtrapped||(l.scrollendtrapped=!0,l.bind(l.doc,u.transitionend,l.onScrollEnd,!1)):(l.scrollendtrapped&&clearTimeout(l.scrollendtrapped),l.scrollendtrapped=setTimeout(l.onScrollEnd,s));var c=o,d=i;l.timerscroll={bz:new BezierClass(c,l.newscrolly,s,0,0,.58,1),bh:new BezierClass(d,l.newscrollx,s,0,0,.58,1)},l.cursorfreezed||(l.timerscroll.tm=setInterval(function(){l.showCursor(l.getScrollTop(),l.getScrollLeft())},60))}l.synched("doScroll-set",function(){l.timer=0,l.scrollendtrapped&&(l.scrollrunning=!0),l.setScrollTop(l.newscrolly),l.setScrollLeft(l.newscrollx),l.scrollendtrapped||l.onScrollEnd()})},50)))},this.cancelScroll=function(){if(!l.scrollendtrapped)return!0;var e=l.getScrollTop(),t=l.getScrollLeft();return l.scrollrunning=!1,u.transitionend||clearTimeout(u.transitionend),l.scrollendtrapped=!1,l._unbind(l.doc,u.transitionend,l.onScrollEnd),l.prepareTransition(0),l.setScrollTop(e),l.railh&&l.setScrollLeft(t),l.timerscroll&&l.timerscroll.tm&&clearInterval(l.timerscroll.tm),l.timerscroll=!1,l.cursorfreezed=!1,l.showCursor(e,t),l},this.onScrollEnd=function(){l.scrollendtrapped&&l._unbind(l.doc,u.transitionend,l.onScrollEnd),l.scrollendtrapped=!1,l.prepareTransition(0),l.timerscroll&&l.timerscroll.tm&&clearInterval(l.timerscroll.tm),l.timerscroll=!1;var e=l.getScrollTop(),t=l.getScrollLeft();if(l.setScrollTop(e),l.railh&&l.setScrollLeft(t),l.noticeCursor(!1,e,t),l.cursorfreezed=!1,e<0?e=0:e>l.page.maxh&&(e=l.page.maxh),t<0?t=0:t>l.page.maxw&&(t=l.page.maxw),e!=l.newscrolly||t!=l.newscrollx)return l.doScrollPos(t,e,l.opt.snapbackspeed);if(l.onscrollend&&l.scrollrunning){var o={type:"scrollend",current:{x:t,y:e},end:{x:l.newscrollx,y:l.newscrolly}};l.onscrollend.call(l,o)}l.scrollrunning=!1}):(this.doScrollLeft=function(e,t){var o=l.scrollrunning?l.newscrolly:l.getScrollTop();l.doScrollPos(e,o,t)},this.doScrollTop=function(e,t){var o=l.scrollrunning?l.newscrollx:l.getScrollLeft();l.doScrollPos(o,e,t)},this.doScrollPos=function(e,t,o){t=void 0===t||!1===t?l.getScrollTop(!0):t;if(l.timer&&l.newscrolly==t&&l.newscrollx==e)return!0;l.timer&&p(l.timer),l.timer=0;var i=l.getScrollTop(),n=l.getScrollLeft();((l.newscrolly-i)*(t-i)<0||(l.newscrollx-n)*(e-n)<0)&&l.cancelScroll(),l.newscrolly=t,l.newscrollx=e,l.bouncescroll&&l.rail.visibility||(l.newscrolly<0?l.newscrolly=0:l.newscrolly>l.page.maxh&&(l.newscrolly=l.page.maxh)),l.bouncescroll&&l.railh.visibility||(l.newscrollx<0?l.newscrollx=0:l.newscrollx>l.page.maxw&&(l.newscrollx=l.page.maxw)),l.dst={},l.dst.x=e-n,l.dst.y=t-i,l.dst.px=n,l.dst.py=i;var r=Math.round(Math.sqrt(Math.pow(l.dst.x,2)+Math.pow(l.dst.y,2)));l.dst.ax=l.dst.x/r,l.dst.ay=l.dst.y/r;var s=0,a=r;0==l.dst.x?(s=i,a=t,l.dst.ay=1,l.dst.py=0):0==l.dst.y&&(s=n,a=e,l.dst.ax=1,l.dst.px=0);var c=l.getTransitionSpeed(r);if(o&&o<=1&&(c*=o),l.bzscroll=c>0&&(l.bzscroll?l.bzscroll.update(a,c):new BezierClass(s,a,c,0,1,0,1)),!l.timer){(i==l.page.maxh&&t>=l.page.maxh||n==l.page.maxw&&e>=l.page.maxw)&&l.checkContentSize();var d=1;if(l.cancelAnimationFrame=!1,l.timer=1,l.onscrollstart&&!l.scrollrunning){var u={type:"scrollstart",current:{x:n,y:i},request:{x:e,y:t},end:{x:l.newscrollx,y:l.newscrolly},speed:c};l.onscrollstart.call(l,u)}!function e(){if(l.cancelAnimationFrame)return!0;if(l.scrollrunning=!0,d=1-d)return l.timer=h(e)||1;var t=0,o=sy=l.getScrollTop();l.dst.ay?(((i=(o=l.bzscroll?l.dst.py+l.bzscroll.getNow()*l.dst.ay:l.newscrolly)-sy)<0&&o<l.newscrolly||i>0&&o>l.newscrolly)&&(o=l.newscrolly),l.setScrollTop(o),o==l.newscrolly&&(t=1)):t=1;var i,n=sx=l.getScrollLeft();l.dst.ax?(((i=(n=l.bzscroll?l.dst.px+l.bzscroll.getNow()*l.dst.ax:l.newscrollx)-sx)<0&&n<l.newscrollx||i>0&&n>l.newscrollx)&&(n=l.newscrollx),l.setScrollLeft(n),n==l.newscrollx&&(t+=1)):t+=1;if(2==t){if(l.timer=0,l.cursorfreezed=!1,l.bzscroll=!1,l.scrollrunning=!1,o<0?o=0:o>l.page.maxh&&(o=l.page.maxh),n<0?n=0:n>l.page.maxw&&(n=l.page.maxw),n!=l.newscrollx||o!=l.newscrolly)l.doScrollPos(n,o);else if(l.onscrollend){var r={type:"scrollend",current:{x:sx,y:sy},end:{x:l.newscrollx,y:l.newscrolly}};l.onscrollend.call(l,r)}}else l.timer=h(e)||1}(),(i==l.page.maxh&&t>=i||n==l.page.maxw&&e>=n)&&l.checkContentSize(),l.noticeCursor()}},this.cancelScroll=function(){return l.timer&&p(l.timer),l.timer=0,l.bzscroll=!1,l.scrollrunning=!1,l}):(this.doScrollLeft=function(e,t){var o=l.getScrollTop();l.doScrollPos(e,o,t)},this.doScrollTop=function(e,t){var o=l.getScrollLeft();l.doScrollPos(o,e,t)},this.doScrollPos=function(e,t,o){var i=e>l.page.maxw?l.page.maxw:e;i<0&&(i=0);var n=t>l.page.maxh?l.page.maxh:t;n<0&&(n=0),l.synched("scroll",function(){l.setScrollTop(n),l.setScrollLeft(i)})},this.cancelScroll=function(){}),this.doScrollBy=function(e,t){var o=0;t?o=Math.floor((l.scroll.y-e)*l.scrollratio.y):o=(l.timer?l.newscrolly:l.getScrollTop(!0))-e;if(l.bouncescroll){var i=Math.round(l.view.h/2);o<-i?o=-i:o>l.page.maxh+i&&(o=l.page.maxh+i)}return l.cursorfreezed=!1,py=l.getScrollTop(!0),o<0&&py<=0?l.noticeCursor():o>l.page.maxh&&py>=l.page.maxh?(l.checkContentSize(),l.noticeCursor()):void l.doScrollTop(o)},this.doScrollLeftBy=function(e,t){var o=0;t?o=Math.floor((l.scroll.x-e)*l.scrollratio.x):o=(l.timer?l.newscrollx:l.getScrollLeft(!0))-e;if(l.bouncescroll){var i=Math.round(l.view.w/2);o<-i?o=-i:o>l.page.maxw+i&&(o=l.page.maxw+i)}return l.cursorfreezed=!1,px=l.getScrollLeft(!0),o<0&&px<=0?l.noticeCursor():o>l.page.maxw&&px>=l.page.maxw?l.noticeCursor():void l.doScrollLeft(o)},this.doScrollTo=function(e,t){var o=t?Math.round(e*l.scrollratio.y):e;o<0?o=0:o>l.page.maxh&&(o=l.page.maxh),l.cursorfreezed=!1,l.doScrollTop(e)},this.checkContentSize=function(){var e=l.getContentSize();e.h==l.page.h&&e.w==l.page.w||l.resize(!1,e)},l.onscroll=function(e){l.rail.drag||l.cursorfreezed||l.synched("scroll",function(){l.scroll.y=Math.round(l.getScrollTop()*(1/l.scrollratio.y)),l.railh&&(l.scroll.x=Math.round(l.getScrollLeft()*(1/l.scrollratio.x))),l.noticeCursor()})},l.bind(l.docscroll,"scroll",l.onscroll),this.doZoomIn=function(e){if(!l.zoomactive){l.zoomactive=!0,l.zoomrestore={style:{}};var t=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],o=l.win[0].style;for(var i in t){var n=t[i];l.zoomrestore.style[n]=void 0!==o[n]?o[n]:""}l.zoomrestore.style.width=l.win.css("width"),l.zoomrestore.style.height=l.win.css("height"),l.zoomrestore.padding={w:l.win.outerWidth()-l.win.width(),h:l.win.outerHeight()-l.win.height()},u.isios4&&(l.zoomrestore.scrollTop=s(window).scrollTop(),s(window).scrollTop(0)),l.win.css({position:u.isios4?"absolute":"fixed",top:0,left:0,"z-index":r+100,margin:"0px"});var a=l.win.css("backgroundColor");return(""==a||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(a))&&l.win.css("backgroundColor","#fff"),l.rail.css({"z-index":r+101}),l.zoom.css({"z-index":r+102}),l.zoom.css("backgroundPosition","0px -18px"),l.resizeZoom(),l.onzoomin&&l.onzoomin.call(l),l.cancelEvent(e)}},this.doZoomOut=function(e){if(l.zoomactive)return l.zoomactive=!1,l.win.css("margin",""),l.win.css(l.zoomrestore.style),u.isios4&&s(window).scrollTop(l.zoomrestore.scrollTop),l.rail.css({"z-index":l.zindex}),l.zoom.css({"z-index":l.zindex}),l.zoomrestore=!1,l.zoom.css("backgroundPosition","0px 0px"),l.onResize(),l.onzoomout&&l.onzoomout.call(l),l.cancelEvent(e)},this.doZoom=function(e){return l.zoomactive?l.doZoomOut(e):l.doZoomIn(e)},this.resizeZoom=function(){if(l.zoomactive){var e=l.getScrollTop();l.win.css({width:s(window).width()-l.zoomrestore.padding.w+"px",height:s(window).height()-l.zoomrestore.padding.h+"px"}),l.onResize(),l.setScrollTop(Math.min(l.page.maxh,e))}},this.init(),s.nicescroll.push(this)},y=function(e){var t=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.time=function(){return+new Date},this.reset=function(e,o){t.stop();var i=t.time();t.steptime=0,t.lasttime=i,t.speedx=0,t.speedy=0,t.lastx=e,t.lasty=o,t.lastscrollx=-1,t.lastscrolly=-1},this.update=function(e,o){var i=t.time();t.steptime=i-t.lasttime,t.lasttime=i;var n=o-t.lasty,r=e-t.lastx,s=t.nc.getScrollTop()+n,a=t.nc.getScrollLeft()+r;t.snapx=a<0||a>t.nc.page.maxw,t.snapy=s<0||s>t.nc.page.maxh,t.speedx=r,t.speedy=n,t.lastx=e,t.lasty=o},this.stop=function(){t.nc.unsynched("domomentum2d"),t.timer&&clearTimeout(t.timer),t.timer=0,t.lastscrollx=-1,t.lastscrolly=-1},this.doSnapy=function(e,o){var i=!1;o<0?(o=0,i=!0):o>t.nc.page.maxh&&(o=t.nc.page.maxh,i=!0),e<0?(e=0,i=!0):e>t.nc.page.maxw&&(e=t.nc.page.maxw,i=!0),i&&t.nc.doScrollPos(e,o,t.nc.opt.snapbackspeed)},this.doMomentum=function(e){var o=t.time(),i=e?o+e:t.lasttime,n=t.nc.getScrollLeft(),r=t.nc.getScrollTop(),s=t.nc.page.maxh,a=t.nc.page.maxw;t.speedx=a>0?Math.min(60,t.speedx):0,t.speedy=s>0?Math.min(60,t.speedy):0;var l=i&&o-i<=60;(r<0||r>s||n<0||n>a)&&(l=!1);var c=!(!t.speedy||!l)&&t.speedy,d=!(!t.speedx||!l)&&t.speedx;if(c||d){var u=Math.max(16,t.steptime);if(u>50){var h=u/50;t.speedx*=h,t.speedy*=h,u=50}t.demulxy=0,t.lastscrollx=t.nc.getScrollLeft(),t.chkx=t.lastscrollx,t.lastscrolly=t.nc.getScrollTop(),t.chky=t.lastscrolly;var p=t.lastscrollx,m=t.lastscrolly,v=function(){var e=t.time()-o>600?.04:.02;t.speedx&&(p=Math.floor(t.lastscrollx-t.speedx*(1-t.demulxy)),t.lastscrollx=p,(p<0||p>a)&&(e=.1)),t.speedy&&(m=Math.floor(t.lastscrolly-t.speedy*(1-t.demulxy)),t.lastscrolly=m,(m<0||m>s)&&(e=.1)),t.demulxy=Math.min(1,t.demulxy+e),t.nc.synched("domomentum2d",function(){t.speedx&&(t.nc.getScrollLeft()!=t.chkx&&t.stop(),t.chkx=p,t.nc.setScrollLeft(p));t.speedy&&(t.nc.getScrollTop()!=t.chky&&t.stop(),t.chky=m,t.nc.setScrollTop(m));t.timer||(t.nc.hideCursor(),t.doSnapy(p,m))}),t.demulxy<1?t.timer=setTimeout(v,u):(t.stop(),t.nc.hideCursor(),t.doSnapy(p,m))};v()}else t.doSnapy(t.nc.getScrollLeft(),t.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,t,o){var i=s.data(e,"__nicescroll")||!1;return i&&i.ishwscroll?i.getScrollTop():x.call(e)},set:function(e,t){var o=s.data(e,"__nicescroll")||!1;return o&&o.ishwscroll?o.setScrollTop(parseInt(t)):x.call(e,t),this}},e.fn.scrollTop=function(e){if(void 0===e){var t=this[0]&&s.data(this[0],"__nicescroll")||!1;return t&&t.ishwscroll?t.getScrollTop():x.call(this)}return this.each(function(){var t=s.data(this,"__nicescroll")||!1;t&&t.ishwscroll?t.setScrollTop(parseInt(e)):x.call(s(this),e)})};var S=e.fn.scrollLeft;s.cssHooks.pageXOffset={get:function(e,t,o){var i=s.data(e,"__nicescroll")||!1;return i&&i.ishwscroll?i.getScrollLeft():S.call(e)},set:function(e,t){var o=s.data(e,"__nicescroll")||!1;return o&&o.ishwscroll?o.setScrollLeft(parseInt(t)):S.call(e,t),this}},e.fn.scrollLeft=function(e){if(void 0===e){var t=this[0]&&s.data(this[0],"__nicescroll")||!1;return t&&t.ishwscroll?t.getScrollLeft():S.call(this)}return this.each(function(){var t=s.data(this,"__nicescroll")||!1;t&&t.ishwscroll?t.setScrollLeft(parseInt(e)):S.call(s(this),e)})};var T=function(e){var t=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){for(var o=0,i=0;o<t.length;o++)e.call(t[o],i++);return t},this.push=function(e){t[t.length]=e,t.length++},this.eq=function(e){return t[e]},e)for(a=0;a<e.length;a++){var o=s.data(e[a],"__nicescroll")||!1;o&&(this[this.length]=o,this.length++)}return this};!function(e,t,o){for(var i=0;i<t.length;i++)o(e,t[i])}(T.prototype,["show","hide","toggle","onResize","resize","remove","stop","doScrollPos"],function(e,t){e[t]=function(){var e=arguments;return this.each(function(){this[t].apply(this,e)})}}),e.fn.getNiceScroll=function(e){return void 0===e?new T(this):this[e]&&s.data(this[e],"__nicescroll")||!1},e.extend(e.expr[":"],{nicescroll:function(e){return!!s.data(e,"__nicescroll")}}),s.fn.niceScroll=function(e,t){void 0===t&&("object"!=typeof e||"jquery"in e||(t=e,e=!1));var o=new T;void 0===t&&(t={}),e&&(t.doc=s(e),t.win=s(this));var i=!("doc"in t);return i||"win"in t||(t.win=s(this)),this.each(function(){var e=s(this).data("__nicescroll")||!1;e||(t.doc=i?s(this):t.doc,e=new b(t,s(this)),s(this).data("__nicescroll",e)),o.push(e)}),1==o.length?o[0]:o},window.NiceScroll={getjQuery:function(){return e}},s.nicescroll||(s.nicescroll=new T,s.nicescroll.options=g)}(jQuery),function(e){e.flexslider=function(t,o){var i=e(t);i.vars=e.extend({},e.flexslider.defaults,o);var n,r=i.vars.namespace,s=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture,a=("ontouchstart"in window||s||window.DocumentTouch&&document instanceof DocumentTouch)&&i.vars.touch,l="click touchend MSPointerUp keyup",c="",d="vertical"===i.vars.direction,u=i.vars.reverse,h=i.vars.itemWidth>0,p="fade"===i.vars.animation,m=""!==i.vars.asNavFor,v={};e.data(t,"flexslider",i),v={init:function(){i.animating=!1,i.currentSlide=parseInt(i.vars.startAt?i.vars.startAt:0,10),isNaN(i.currentSlide)&&(i.currentSlide=0),i.animatingTo=i.currentSlide,i.atEnd=0===i.currentSlide||i.currentSlide===i.last,i.containerSelector=i.vars.selector.substr(0,i.vars.selector.search(" ")),i.slides=e(i.vars.selector,i),i.container=e(i.containerSelector,i),i.count=i.slides.length,i.syncExists=e(i.vars.sync).length>0,"slide"===i.vars.animation&&(i.vars.animation="swing"),i.prop=d?"top":"marginLeft",i.args={},i.manualPause=!1,i.stopped=!1,i.started=!1,i.startTimeout=null,i.transitions=!i.vars.video&&!p&&i.vars.useCSS&&function(){var e=document.createElement("div"),t=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var o in t)if(void 0!==e.style[t[o]])return i.pfx=t[o].replace("Perspective","").toLowerCase(),i.prop="-"+i.pfx+"-transform",!0;return!1}(),i.ensureAnimationEnd="",""!==i.vars.controlsContainer&&(i.controlsContainer=e(i.vars.controlsContainer).length>0&&e(i.vars.controlsContainer)),""!==i.vars.manualControls&&(i.manualControls=e(i.vars.manualControls).length>0&&e(i.vars.manualControls)),""!==i.vars.customDirectionNav&&(i.customDirectionNav=2===e(i.vars.customDirectionNav).length&&e(i.vars.customDirectionNav)),i.vars.randomize&&(i.slides.sort(function(){return Math.round(Math.random())-.5}),i.container.empty().append(i.slides)),i.doMath(),i.setup("init"),i.vars.controlNav&&v.controlNav.setup(),i.vars.directionNav&&v.directionNav.setup(),i.vars.keyboard&&(1===e(i.containerSelector).length||i.vars.multipleKeyboard)&&e(document).bind("keyup",function(e){var t=e.keyCode;if(!i.animating&&(39===t||37===t)){var o=39===t?i.getTarget("next"):37===t&&i.getTarget("prev");i.flexAnimate(o,i.vars.pauseOnAction)}}),i.vars.mousewheel&&i.bind("mousewheel",function(e,t,o,n){e.preventDefault();var r=i.getTarget(0>t?"next":"prev");i.flexAnimate(r,i.vars.pauseOnAction)}),i.vars.pausePlay&&v.pausePlay.setup(),i.vars.slideshow&&i.vars.pauseInvisible&&v.pauseInvisible.init(),i.vars.slideshow&&(i.vars.pauseOnHover&&i.hover(function(){i.manualPlay||i.manualPause||i.pause()},function(){i.manualPause||i.manualPlay||i.stopped||i.play()}),i.vars.pauseInvisible&&v.pauseInvisible.isHidden()||(i.vars.initDelay>0?i.startTimeout=setTimeout(i.play,i.vars.initDelay):i.play())),m&&v.asNav.setup(),a&&i.vars.touch&&v.touch(),(!p||p&&i.vars.smoothHeight)&&e(window).bind("resize orientationchange focus",v.resize),i.find("img").attr("draggable","false"),setTimeout(function(){i.vars.start(i)},200)},asNav:{setup:function(){i.asNav=!0,i.animatingTo=Math.floor(i.currentSlide/i.move),i.currentItem=i.currentSlide,i.slides.removeClass(r+"active-slide").eq(i.currentItem).addClass(r+"active-slide"),s?(t._slider=i,i.slides.each(function(){var t=this;t._gesture=new MSGesture,t._gesture.target=t,t.addEventListener("MSPointerDown",function(e){e.preventDefault(),e.currentTarget._gesture&&e.currentTarget._gesture.addPointer(e.pointerId)},!1),t.addEventListener("MSGestureTap",function(t){t.preventDefault();var o=e(this),n=o.index();e(i.vars.asNavFor).data("flexslider").animating||o.hasClass("active")||(i.direction=i.currentItem<n?"next":"prev",i.flexAnimate(n,i.vars.pauseOnAction,!1,!0,!0))})})):i.slides.on(l,function(t){t.preventDefault();var o=e(this),n=o.index();0>=o.offset().left-e(i).scrollLeft()&&o.hasClass(r+"active-slide")?i.flexAnimate(i.getTarget("prev"),!0):e(i.vars.asNavFor).data("flexslider").animating||o.hasClass(r+"active-slide")||(i.direction=i.currentItem<n?"next":"prev",i.flexAnimate(n,i.vars.pauseOnAction,!1,!0,!0))})}},controlNav:{setup:function(){i.manualControls?v.controlNav.setupManual():v.controlNav.setupPaging()},setupPaging:function(){var t,o,n="thumbnails"===i.vars.controlNav?"control-thumbs":"control-paging",s=1;if(i.controlNavScaffold=e('<ol class="'+r+"control-nav "+r+n+'"></ol>'),i.pagingCount>1)for(var a=0;a<i.pagingCount;a++){if(o=i.slides.eq(a),t="thumbnails"===i.vars.controlNav?'<img src="'+o.attr("data-thumb")+'"/>':"<a>"+s+"</a>","thumbnails"===i.vars.controlNav&&!0===i.vars.thumbCaptions){var d=o.attr("data-thumbcaption");""!==d&&void 0!==d&&(t+='<span class="'+r+'caption">'+d+"</span>")}i.controlNavScaffold.append("<li>"+t+"</li>"),s++}i.controlsContainer?e(i.controlsContainer).append(i.controlNavScaffold):i.append(i.controlNavScaffold),v.controlNav.set(),v.controlNav.active(),i.controlNavScaffold.delegate("a, img",l,function(t){if(t.preventDefault(),""===c||c===t.type){var o=e(this),n=i.controlNav.index(o);o.hasClass(r+"active")||(i.direction=n>i.currentSlide?"next":"prev",i.flexAnimate(n,i.vars.pauseOnAction))}""===c&&(c=t.type),v.setToClearWatchedEvent()})},setupManual:function(){i.controlNav=i.manualControls,v.controlNav.active(),i.controlNav.bind(l,function(t){if(t.preventDefault(),""===c||c===t.type){var o=e(this),n=i.controlNav.index(o);o.hasClass(r+"active")||(i.direction=n>i.currentSlide?"next":"prev",i.flexAnimate(n,i.vars.pauseOnAction))}""===c&&(c=t.type),v.setToClearWatchedEvent()})},set:function(){var t="thumbnails"===i.vars.controlNav?"img":"a";i.controlNav=e("."+r+"control-nav li "+t,i.controlsContainer?i.controlsContainer:i)},active:function(){i.controlNav.removeClass(r+"active").eq(i.animatingTo).addClass(r+"active")},update:function(t,o){i.pagingCount>1&&"add"===t?i.controlNavScaffold.append(e("<li><a>"+i.count+"</a></li>")):1===i.pagingCount?i.controlNavScaffold.find("li").remove():i.controlNav.eq(o).closest("li").remove(),v.controlNav.set(),i.pagingCount>1&&i.pagingCount!==i.controlNav.length?i.update(o,t):v.controlNav.active()}},directionNav:{setup:function(){var t=e('<ul class="'+r+'direction-nav"><li class="'+r+'nav-prev"><a class="'+r+'prev" href="#">'+i.vars.prevText+'</a></li><li class="'+r+'nav-next"><a class="'+r+'next" href="#">'+i.vars.nextText+"</a></li></ul>");i.customDirectionNav?i.directionNav=i.customDirectionNav:i.controlsContainer?(e(i.controlsContainer).append(t),i.directionNav=e("."+r+"direction-nav li a",i.controlsContainer)):(i.append(t),i.directionNav=e("."+r+"direction-nav li a",i)),v.directionNav.update(),i.directionNav.bind(l,function(t){var o;t.preventDefault(),(""===c||c===t.type)&&(o=i.getTarget(e(this).hasClass(r+"next")?"next":"prev"),i.flexAnimate(o,i.vars.pauseOnAction)),""===c&&(c=t.type),v.setToClearWatchedEvent()})},update:function(){var e=r+"disabled";1===i.pagingCount?i.directionNav.addClass(e).attr("tabindex","-1"):i.vars.animationLoop?i.directionNav.removeClass(e).removeAttr("tabindex"):0===i.animatingTo?i.directionNav.removeClass(e).filter("."+r+"prev").addClass(e).attr("tabindex","-1"):i.animatingTo===i.last?i.directionNav.removeClass(e).filter("."+r+"next").addClass(e).attr("tabindex","-1"):i.directionNav.removeClass(e).removeAttr("tabindex")}},pausePlay:{setup:function(){var t=e('<div class="'+r+'pauseplay"><a></a></div>');i.controlsContainer?(i.controlsContainer.append(t),i.pausePlay=e("."+r+"pauseplay a",i.controlsContainer)):(i.append(t),i.pausePlay=e("."+r+"pauseplay a",i)),v.pausePlay.update(i.vars.slideshow?r+"pause":r+"play"),i.pausePlay.bind(l,function(t){t.preventDefault(),(""===c||c===t.type)&&(e(this).hasClass(r+"pause")?(i.manualPause=!0,i.manualPlay=!1,i.pause()):(i.manualPause=!1,i.manualPlay=!0,i.play())),""===c&&(c=t.type),v.setToClearWatchedEvent()})},update:function(e){"play"===e?i.pausePlay.removeClass(r+"pause").addClass(r+"play").html(i.vars.playText):i.pausePlay.removeClass(r+"play").addClass(r+"pause").html(i.vars.pauseText)}},touch:function(){var e,o,n,r,a,l,c,m,v,f=!1,g=0,w=0,b=0;s?(t.style.msTouchAction="none",t._gesture=new MSGesture,t._gesture.target=t,t.addEventListener("MSPointerDown",function(e){e.stopPropagation(),i.animating?e.preventDefault():(i.pause(),t._gesture.addPointer(e.pointerId),b=0,r=d?i.h:i.w,l=Number(new Date),n=h&&u&&i.animatingTo===i.last?0:h&&u?i.limit-(i.itemW+i.vars.itemMargin)*i.move*i.animatingTo:h&&i.currentSlide===i.last?i.limit:h?(i.itemW+i.vars.itemMargin)*i.move*i.currentSlide:u?(i.last-i.currentSlide+i.cloneOffset)*r:(i.currentSlide+i.cloneOffset)*r)},!1),t._slider=i,t.addEventListener("MSGestureChange",function(e){e.stopPropagation();var o=e.target._slider;if(o){var i=-e.translationX,s=-e.translationY;return a=b+=d?s:i,f=d?Math.abs(b)<Math.abs(-i):Math.abs(b)<Math.abs(-s),e.detail===e.MSGESTURE_FLAG_INERTIA?void setImmediate(function(){t._gesture.stop()}):void((!f||Number(new Date)-l>500)&&(e.preventDefault(),!p&&o.transitions&&(o.vars.animationLoop||(a=b/(0===o.currentSlide&&0>b||o.currentSlide===o.last&&b>0?Math.abs(b)/r+2:1)),o.setProps(n+a,"setTouch"))))}},!1),t.addEventListener("MSGestureEnd",function(t){t.stopPropagation();var i=t.target._slider;if(i){if(i.animatingTo===i.currentSlide&&!f&&null!==a){var s=u?-a:a,c=i.getTarget(s>0?"next":"prev");i.canAdvance(c)&&(Number(new Date)-l<550&&Math.abs(s)>50||Math.abs(s)>r/2)?i.flexAnimate(c,i.vars.pauseOnAction):p||i.flexAnimate(i.currentSlide,i.vars.pauseOnAction,!0)}e=null,o=null,a=null,n=null,b=0}},!1)):(c=function(s){i.animating?s.preventDefault():(window.navigator.msPointerEnabled||1===s.touches.length)&&(i.pause(),r=d?i.h:i.w,l=Number(new Date),g=s.touches[0].pageX,w=s.touches[0].pageY,n=h&&u&&i.animatingTo===i.last?0:h&&u?i.limit-(i.itemW+i.vars.itemMargin)*i.move*i.animatingTo:h&&i.currentSlide===i.last?i.limit:h?(i.itemW+i.vars.itemMargin)*i.move*i.currentSlide:u?(i.last-i.currentSlide+i.cloneOffset)*r:(i.currentSlide+i.cloneOffset)*r,e=d?w:g,o=d?g:w,t.addEventListener("touchmove",m,!1),t.addEventListener("touchend",v,!1))},m=function(t){g=t.touches[0].pageX,w=t.touches[0].pageY,a=d?e-w:e-g;(!(f=d?Math.abs(a)<Math.abs(g-o):Math.abs(a)<Math.abs(w-o))||Number(new Date)-l>500)&&(t.preventDefault(),!p&&i.transitions&&(i.vars.animationLoop||(a/=0===i.currentSlide&&0>a||i.currentSlide===i.last&&a>0?Math.abs(a)/r+2:1),i.setProps(n+a,"setTouch")))},v=function(s){if(t.removeEventListener("touchmove",m,!1),i.animatingTo===i.currentSlide&&!f&&null!==a){var c=u?-a:a,d=i.getTarget(c>0?"next":"prev");i.canAdvance(d)&&(Number(new Date)-l<550&&Math.abs(c)>50||Math.abs(c)>r/2)?i.flexAnimate(d,i.vars.pauseOnAction):p||i.flexAnimate(i.currentSlide,i.vars.pauseOnAction,!0)}t.removeEventListener("touchend",v,!1),e=null,o=null,a=null,n=null},t.addEventListener("touchstart",c,!1))},resize:function(){!i.animating&&i.is(":visible")&&(h||i.doMath(),p?v.smoothHeight():h?(i.slides.width(i.computedW),i.update(i.pagingCount),i.setProps()):d?(i.viewport.height(i.h),i.setProps(i.h,"setTotal")):(i.vars.smoothHeight&&v.smoothHeight(),i.newSlides.width(i.computedW),i.setProps(i.computedW,"setTotal")))},smoothHeight:function(e){if(!d||p){var t=p?i:i.viewport;e?t.animate({height:i.slides.eq(i.animatingTo).height()},e):t.height(i.slides.eq(i.animatingTo).height())}},sync:function(t){var o=e(i.vars.sync).data("flexslider"),n=i.animatingTo;switch(t){case"animate":o.flexAnimate(n,i.vars.pauseOnAction,!1,!0);break;case"play":o.playing||o.asNav||o.play();break;case"pause":o.pause()}},uniqueID:function(t){return t.filter("[id]").add(t.find("[id]")).each(function(){var t=e(this);t.attr("id",t.attr("id")+"_clone")}),t},pauseInvisible:{visProp:null,init:function(){var e=v.pauseInvisible.getHiddenProp();if(e){var t=e.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(t,function(){v.pauseInvisible.isHidden()?i.startTimeout?clearTimeout(i.startTimeout):i.pause():i.started?i.play():i.vars.initDelay>0?setTimeout(i.play,i.vars.initDelay):i.play()})}},isHidden:function(){var e=v.pauseInvisible.getHiddenProp();return!!e&&document[e]},getHiddenProp:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t<e.length;t++)if(e[t]+"Hidden"in document)return e[t]+"Hidden";return null}},setToClearWatchedEvent:function(){clearTimeout(n),n=setTimeout(function(){c=""},3e3)}},i.flexAnimate=function(t,o,n,s,l){if(i.vars.animationLoop||t===i.currentSlide||(i.direction=t>i.currentSlide?"next":"prev"),m&&1===i.pagingCount&&(i.direction=i.currentItem<t?"next":"prev"),!i.animating&&(i.canAdvance(t,l)||n)&&i.is(":visible")){if(m&&s){var c=e(i.vars.asNavFor).data("flexslider");if(i.atEnd=0===t||t===i.count-1,c.flexAnimate(t,!0,!1,!0,l),i.direction=i.currentItem<t?"next":"prev",c.direction=i.direction,Math.ceil((t+1)/i.visible)-1===i.currentSlide||0===t)return i.currentItem=t,i.slides.removeClass(r+"active-slide").eq(t).addClass(r+"active-slide"),!1;i.currentItem=t,i.slides.removeClass(r+"active-slide").eq(t).addClass(r+"active-slide"),t=Math.floor(t/i.visible)}if(i.animating=!0,i.animatingTo=t,o&&i.pause(),i.vars.before(i),i.syncExists&&!l&&v.sync("animate"),i.vars.controlNav&&v.controlNav.active(),h||i.slides.removeClass(r+"active-slide").eq(t).addClass(r+"active-slide"),i.atEnd=0===t||t===i.last,i.vars.directionNav&&v.directionNav.update(),t===i.last&&(i.vars.end(i),i.vars.animationLoop||i.pause()),p)a?(i.slides.eq(i.currentSlide).css({opacity:0,zIndex:1}),i.slides.eq(t).css({opacity:1,zIndex:2}),i.wrapup(b)):(i.slides.eq(i.currentSlide).css({zIndex:1}).animate({opacity:0},i.vars.animationSpeed,i.vars.easing),i.slides.eq(t).css({zIndex:2}).animate({opacity:1},i.vars.animationSpeed,i.vars.easing,i.wrapup));else{var f,g,w,b=d?i.slides.filter(":first").height():i.computedW;h?(f=i.vars.itemMargin,g=(w=(i.itemW+f)*i.move*i.animatingTo)>i.limit&&1!==i.visible?i.limit:w):g=0===i.currentSlide&&t===i.count-1&&i.vars.animationLoop&&"next"!==i.direction?u?(i.count+i.cloneOffset)*b:0:i.currentSlide===i.last&&0===t&&i.vars.animationLoop&&"prev"!==i.direction?u?0:(i.count+1)*b:u?(i.count-1-t+i.cloneOffset)*b:(t+i.cloneOffset)*b,i.setProps(g,"",i.vars.animationSpeed),i.transitions?(i.vars.animationLoop&&i.atEnd||(i.animating=!1,i.currentSlide=i.animatingTo),i.container.unbind("webkitTransitionEnd transitionend"),i.container.bind("webkitTransitionEnd transitionend",function(){clearTimeout(i.ensureAnimationEnd),i.wrapup(b)}),clearTimeout(i.ensureAnimationEnd),i.ensureAnimationEnd=setTimeout(function(){i.wrapup(b)},i.vars.animationSpeed+100)):i.container.animate(i.args,i.vars.animationSpeed,i.vars.easing,function(){i.wrapup(b)})}i.vars.smoothHeight&&v.smoothHeight(i.vars.animationSpeed)}},i.wrapup=function(e){p||h||(0===i.currentSlide&&i.animatingTo===i.last&&i.vars.animationLoop?i.setProps(e,"jumpEnd"):i.currentSlide===i.last&&0===i.animatingTo&&i.vars.animationLoop&&i.setProps(e,"jumpStart")),i.animating=!1,i.currentSlide=i.animatingTo,i.vars.after(i)},i.animateSlides=function(){!i.animating&&i.flexAnimate(i.getTarget("next"))},i.pause=function(){clearInterval(i.animatedSlides),i.animatedSlides=null,i.playing=!1,i.vars.pausePlay&&v.pausePlay.update("play"),i.syncExists&&v.sync("pause")},i.play=function(){i.playing&&clearInterval(i.animatedSlides),i.animatedSlides=i.animatedSlides||setInterval(i.animateSlides,i.vars.slideshowSpeed),i.started=i.playing=!0,i.vars.pausePlay&&v.pausePlay.update("pause"),i.syncExists&&v.sync("play")},i.stop=function(){i.pause(),i.stopped=!0},i.canAdvance=function(e,t){var o=m?i.pagingCount-1:i.last;return!!t||(!(!m||i.currentItem!==i.count-1||0!==e||"prev"!==i.direction)||(!m||0!==i.currentItem||e!==i.pagingCount-1||"next"===i.direction)&&(!(e===i.currentSlide&&!m)&&(!!i.vars.animationLoop||(!i.atEnd||0!==i.currentSlide||e!==o||"next"===i.direction)&&(!i.atEnd||i.currentSlide!==o||0!==e||"next"!==i.direction))))},i.getTarget=function(e){return i.direction=e,"next"===e?i.currentSlide===i.last?0:i.currentSlide+1:0===i.currentSlide?i.last:i.currentSlide-1},i.setProps=function(e,t,o){var n=function(){var o=e||(i.itemW+i.vars.itemMargin)*i.move*i.animatingTo;return-1*function(){if(h)return"setTouch"===t?e:u&&i.animatingTo===i.last?0:u?i.limit-(i.itemW+i.vars.itemMargin)*i.move*i.animatingTo:i.animatingTo===i.last?i.limit:o;switch(t){case"setTotal":return u?(i.count-1-i.currentSlide+i.cloneOffset)*e:(i.currentSlide+i.cloneOffset)*e;case"setTouch":return e;case"jumpEnd":return u?e:i.count*e;case"jumpStart":return u?i.count*e:e;default:return e}}()+"px"}();i.transitions&&(n=d?"translate3d(0,"+n+",0)":"translate3d("+n+",0,0)",o=void 0!==o?o/1e3+"s":"0s",i.container.css("-"+i.pfx+"-transition-duration",o),i.container.css("transition-duration",o)),i.args[i.prop]=n,(i.transitions||void 0===o)&&i.container.css(i.args),i.container.css("transform",n)},i.setup=function(t){var o,n;p?(i.slides.css({width:"100%",float:"left",marginRight:"-100%",position:"relative"}),"init"===t&&(a?i.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+i.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(i.currentSlide).css({opacity:1,zIndex:2}):0==i.vars.fadeFirstSlide?i.slides.css({opacity:0,display:"block",zIndex:1}).eq(i.currentSlide).css({zIndex:2}).css({opacity:1}):i.slides.css({opacity:0,display:"block",zIndex:1}).eq(i.currentSlide).css({zIndex:2}).animate({opacity:1},i.vars.animationSpeed,i.vars.easing)),i.vars.smoothHeight&&v.smoothHeight()):("init"===t&&(i.viewport=e('<div class="'+r+'viewport"></div>').css({overflow:"hidden",position:"relative"}).appendTo(i).append(i.container),i.cloneCount=0,i.cloneOffset=0,u&&(n=e.makeArray(i.slides).reverse(),i.slides=e(n),i.container.empty().append(i.slides))),i.vars.animationLoop&&!h&&(i.cloneCount=2,i.cloneOffset=1,"init"!==t&&i.container.find(".clone").remove(),i.container.append(v.uniqueID(i.slides.first().clone().addClass("clone")).attr("aria-hidden","true")).prepend(v.uniqueID(i.slides.last().clone().addClass("clone")).attr("aria-hidden","true"))),i.newSlides=e(i.vars.selector,i),o=u?i.count-1-i.currentSlide+i.cloneOffset:i.currentSlide+i.cloneOffset,d&&!h?(i.container.height(200*(i.count+i.cloneCount)+"%").css("position","absolute").width("100%"),setTimeout(function(){i.newSlides.css({display:"block"}),i.doMath(),i.viewport.height(i.h),i.setProps(o*i.h,"init")},"init"===t?100:0)):(i.container.width(200*(i.count+i.cloneCount)+"%"),i.setProps(o*i.computedW,"init"),setTimeout(function(){i.doMath(),i.newSlides.css({width:i.computedW,float:"left",display:"block"}),i.vars.smoothHeight&&v.smoothHeight()},"init"===t?100:0)));h||i.slides.removeClass(r+"active-slide").eq(i.currentSlide).addClass(r+"active-slide"),i.vars.init(i)},i.doMath=function(){var e=i.slides.first(),t=i.vars.itemMargin,o=i.vars.minItems,n=i.vars.maxItems;i.w=void 0===i.viewport?i.width():i.viewport.width(),i.h=e.height(),i.boxPadding=e.outerWidth()-e.width(),h?(i.itemT=i.vars.itemWidth+t,i.minW=o?o*i.itemT:i.w,i.maxW=n?n*i.itemT-t:i.w,i.itemW=i.minW>i.w?(i.w-t*(o-1))/o:i.maxW<i.w?(i.w-t*(n-1))/n:i.vars.itemWidth>i.w?i.w:i.vars.itemWidth,i.visible=Math.floor(i.w/i.itemW),i.move=i.vars.move>0&&i.vars.move<i.visible?i.vars.move:i.visible,i.pagingCount=Math.ceil((i.count-i.visible)/i.move+1),i.last=i.pagingCount-1,i.limit=1===i.pagingCount?0:i.vars.itemWidth>i.w?i.itemW*(i.count-1)+t*(i.count-1):(i.itemW+t)*i.count-i.w-t):(i.itemW=i.w,i.pagingCount=i.count,i.last=i.count-1),i.computedW=i.itemW-i.boxPadding},i.update=function(e,t){i.doMath(),h||(e<i.currentSlide?i.currentSlide+=1:e<=i.currentSlide&&0!==e&&(i.currentSlide-=1),i.animatingTo=i.currentSlide),i.vars.controlNav&&!i.manualControls&&("add"===t&&!h||i.pagingCount>i.controlNav.length?v.controlNav.update("add"):("remove"===t&&!h||i.pagingCount<i.controlNav.length)&&(h&&i.currentSlide>i.last&&(i.currentSlide-=1,i.animatingTo-=1),v.controlNav.update("remove",i.last))),i.vars.directionNav&&v.directionNav.update()},i.addSlide=function(t,o){var n=e(t);i.count+=1,i.last=i.count-1,d&&u?void 0!==o?i.slides.eq(i.count-o).after(n):i.container.prepend(n):void 0!==o?i.slides.eq(o).before(n):i.container.append(n),i.update(o,"add"),i.slides=e(i.vars.selector+":not(.clone)",i),i.setup(),i.vars.added(i)},i.removeSlide=function(t){var o=isNaN(t)?i.slides.index(e(t)):t;i.count-=1,i.last=i.count-1,isNaN(t)?e(t,i.slides).remove():d&&u?i.slides.eq(i.last).remove():i.slides.eq(t).remove(),i.doMath(),i.update(o,"remove"),i.slides=e(i.vars.selector+":not(.clone)",i),i.setup(),i.vars.removed(i)},v.init()},e(window).blur(function(e){focused=!1}).focus(function(e){focused=!0}),e.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,fadeFirstSlide:!0,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",customDirectionNav:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){},init:function(){}},e.fn.flexslider=function(t){if(void 0===t&&(t={}),"object"==typeof t)return this.each(function(){var o=e(this),i=t.selector?t.selector:".slides > li",n=o.find(i);1===n.length&&!0===t.allowOneSlide||0===n.length?(n.fadeIn(400),t.start&&t.start(o)):void 0===o.data("flexslider")&&new e.flexslider(this,t)});var o=e(this).data("flexslider");switch(t){case"play":o.play();break;case"pause":o.pause();break;case"stop":o.stop();break;case"next":o.flexAnimate(o.getTarget("next"),!0);break;case"prev":case"previous":o.flexAnimate(o.getTarget("prev"),!0);break;default:"number"==typeof t&&o.flexAnimate(t,!0)}}}(jQuery);;