(function(n){typeof define=="function"&&define.amd?define(["jquery"],n):typeof exports=="object"?module.exports=n:n(jQuery)})(function(n){function f(i){var f=i||window.event,l=o.call(arguments,1),h=0,e=0,u=0,c=0;if(i=n.event.fix(f),i.type="mousewheel","detail"in f&&(u=f.detail*-1),"wheelDelta"in f&&(u=f.wheelDelta),"wheelDeltaY"in f&&(u=f.wheelDeltaY),"wheelDeltaX"in f&&(e=f.wheelDeltaX*-1),"axis"in f&&f.axis===f.HORIZONTAL_AXIS&&(e=u*-1,u=0),h=u===0?e:u,"deltaY"in f&&(u=f.deltaY*-1,h=u),"deltaX"in f&&(e=f.deltaX,u===0&&(h=e*-1)),u!==0||e!==0)return c=Math.max(Math.abs(u),Math.abs(e)),(!t||c<t)&&(t=c),h=Math[h>=1?"floor":"ceil"](h/t),e=Math[e>=1?"floor":"ceil"](e/t),u=Math[u>=1?"floor":"ceil"](u/t),i.deltaX=e,i.deltaY=u,i.deltaFactor=t,l.unshift(i,h,e,u),r&&clearTimeout(r),r=setTimeout(s,200),(n.event.dispatch||n.event.handle).apply(this,l)}function s(){t=null}var e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],i="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],o=Array.prototype.slice,r,t,u;if(n.event.fixHooks)for(u=e.length;u;)n.event.fixHooks[e[--u]]=n.event.mouseHooks;n.event.special.mousewheel={version:"3.1.6",setup:function(){if(this.addEventListener)for(var n=i.length;n;)this.addEventListener(i[--n],f,!1);else this.onmousewheel=f},teardown:function(){if(this.removeEventListener)for(var n=i.length;n;)this.removeEventListener(i[--n],f,!1);else this.onmousewheel=null}};n.fn.extend({mousewheel:function(n){return n?this.bind("mousewheel",n):this.trigger("mousewheel")},unmousewheel:function(n){return this.unbind("mousewheel",n)}})}),function(n){function o(){this===t.elem&&(t.pos=[-260,-260],t.elem=!1,i=3)}var t={pos:[-260,-260]},i=3,r=document,s=r.documentElement,u=r.body,f,e;n.event.special.mwheelIntent={setup:function(){var t=n(this).bind("mousewheel",n.event.special.mwheelIntent.handler);return this!==r&&this!==s&&this!==u&&t.bind("mouseleave",o),t=null,!0},teardown:function(){return n(this).unbind("mousewheel",n.event.special.mwheelIntent.handler).unbind("mouseleave",o),!0},handler:function(r){var u=[r.clientX,r.clientY];if(this===t.elem||Math.abs(t.pos[0]-u[0])>i||Math.abs(t.pos[1]-u[1])>i)return t.elem=this,t.pos=u,i=250,clearTimeout(e),e=setTimeout(function(){i=10},200),clearTimeout(f),f=setTimeout(function(){i=3},1500),r=n.extend({},r,{type:"mwheelIntent"}),(n.event.dispatch||n.event.handle).apply(this,arguments)}};n.fn.extend({mwheelIntent:function(n){return n?this.bind("mwheelIntent",n):this.trigger("mwheelIntent")},unmwheelIntent:function(n){return this.unbind("mwheelIntent",n)}});n(function(){u=r.body;n(r).bind("mwheelIntent.mwheelIntentDefault",n.noop)})}(jQuery);!function(n,t,i){n.fn.jScrollPane=function(r){function u(r,u){function oi(t){var u,d,g,c,p,w,nt=!1,tt=!1;if(f=t,o===i)p=r.scrollTop(),w=r.scrollLeft(),r.css({overflow:"hidden",padding:0}),h=r.innerWidth()+st,s=r.innerHeight(),r.width(h),o=n('<div class="jspPane" />').css("padding",ai).append(r.children()),e=n('<div class="jspContainer" />').css({width:h+"px",height:s+"px"}).append(o).appendTo(r);else{if(r.css("width",""),nt=f.stickToBottom&&or(),tt=f.stickToRight&&sr(),c=r.innerWidth()+st!=h||r.outerHeight()!=s,c&&(h=r.innerWidth()+st,s=r.innerHeight(),e.css({width:h+"px",height:s+"px"})),!c&&gi==y&&o.outerHeight()==v)return r.width(h),void 0;gi=y;o.css("width","");r.width(h);e.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}o.css("overflow","auto");y=t.contentWidth?t.contentWidth:o[0].scrollWidth;v=o[0].scrollHeight;o.css("overflow","");ci=y/h;ni=v/s;k=ni>1;b=ci>1;b||k?(r.addClass("jspScrollable"),u=f.maintainPosition&&(l||a),u&&(d=rt(),g=ut()),nr(),tr(),ir(),u&&(at(tt?y-h:d,!1),it(nt?v-s:g,!1)),lr(),hr(),br(),f.enableKeyboardNavigation&&vr(),f.clickOnTrack&&ur(),pr(),f.hijackInternalLinks&&wr()):(r.removeClass("jspScrollable"),o.css({top:0,left:0,width:e.width()-st}),cr(),ar(),yr(),ki());f.autoReinitialise&&!pt?pt=setInterval(function(){oi(f)},f.autoReinitialiseDelay):!f.autoReinitialise&&pt&&clearInterval(pt);p&&r.scrollTop(0)&&it(p,!1);w&&r.scrollLeft(0)&&at(w,!1);r.trigger("jsp-initialised",[b||k])}function nr(){k&&(e.append(n('<div class="jspVerticalBar" />').append(n('<div class="jspCap jspCapTop" />'),n('<div class="jspTrack" />').append(n('<div class="jspDrag" />').append(n('<div class="jspDragTop" />'),n('<div class="jspDragBottom" />'))),n('<div class="jspCap jspCapBottom" />'))),ti=e.find(">.jspVerticalBar"),g=ti.find(">.jspTrack"),p=g.find(">.jspDrag"),f.showArrows&&(wt=n('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp",tt(0,-1)).bind("click.jsp",vt),bt=n('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp",tt(0,1)).bind("click.jsp",vt),f.arrowScrollOnHover&&(wt.bind("mouseover.jsp",tt(0,-1,wt)),bt.bind("mouseover.jsp",tt(0,1,bt))),bi(g,f.verticalArrowPositions,wt,bt)),yt=s,e.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){yt-=n(this).outerHeight()}),p.hover(function(){p.addClass("jspHover")},function(){p.removeClass("jspHover")}).bind("mousedown.jsp",function(t){n("html").bind("dragstart.jsp selectstart.jsp",vt);p.addClass("jspActive");var i=t.pageY-p.position().top;return n("html").bind("mousemove.jsp",function(n){ht(n.pageY-i,!1)}).bind("mouseup.jsp mouseleave.jsp",di),!1}),pi())}function pi(){g.height(yt+"px");l=0;li=f.verticalGutter+g.outerWidth();o.width(h-li-st);try{0===ti.position().left&&o.css("margin-left",li+"px")}catch(n){}}function tr(){b&&(e.append(n('<div class="jspHorizontalBar" />').append(n('<div class="jspCap jspCapLeft" />'),n('<div class="jspTrack" />').append(n('<div class="jspDrag" />').append(n('<div class="jspDragLeft" />'),n('<div class="jspDragRight" />'))),n('<div class="jspCap jspCapRight" />'))),ii=e.find(">.jspHorizontalBar"),nt=ii.find(">.jspTrack"),w=nt.find(">.jspDrag"),f.showArrows&&(kt=n('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp",tt(-1,0)).bind("click.jsp",vt),dt=n('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp",tt(1,0)).bind("click.jsp",vt),f.arrowScrollOnHover&&(kt.bind("mouseover.jsp",tt(-1,0,kt)),dt.bind("mouseover.jsp",tt(1,0,dt))),bi(nt,f.horizontalArrowPositions,kt,dt)),w.hover(function(){w.addClass("jspHover")},function(){w.removeClass("jspHover")}).bind("mousedown.jsp",function(t){n("html").bind("dragstart.jsp selectstart.jsp",vt);w.addClass("jspActive");var i=t.pageX-w.position().left;return n("html").bind("mousemove.jsp",function(n){lt(n.pageX-i,!1)}).bind("mouseup.jsp mouseleave.jsp",di),!1}),ct=e.innerWidth(),wi())}function wi(){e.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){ct-=n(this).outerWidth()});nt.width(ct+"px");a=0}function ir(){if(b&&k){var t=nt.outerHeight(),i=g.outerWidth();yt-=t;n(ii).find(">.jspCap:visible,>.jspArrow").each(function(){ct+=n(this).outerWidth()});ct-=i;s-=i;h-=t;nt.parent().append(n('<div class="jspCorner" />').css("width",t+"px"));pi();wi()}b&&o.width(e.outerWidth()-st+"px");v=o.outerHeight();ni=v/s;b&&(ot=Math.ceil(1/ci*ct),ot>f.horizontalDragMaxWidth?ot=f.horizontalDragMaxWidth:ot<f.horizontalDragMinWidth&&(ot=f.horizontalDragMinWidth),w.width(ot+"px"),ft=ct-ot,hi(a));k&&(et=Math.ceil(1/ni*yt),et>f.verticalDragMaxHeight?et=f.verticalDragMaxHeight:et<f.verticalDragMinHeight&&(et=f.verticalDragMinHeight),p.height(et+"px"),d=yt-et,si(l))}function bi(n,t,i,r){var e,u="before",f="after";"os"==t&&(t=/Mac/.test(navigator.platform)?"after":"split");t==u?f=t:t==f&&(u=t,e=i,i=r,r=e);n[u](i)[f](r)}function tt(n,t,i){return function(){return rr(n,t,this,i),this.blur(),!1}}function rr(t,i,r,u){r=n(r).addClass("jspActive");var o,e,s=!0,h=function(){0!==t&&c.scrollByX(t*f.arrowButtonSpeed);0!==i&&c.scrollByY(i*f.arrowButtonSpeed);e=setTimeout(h,s?f.initialDelay:f.arrowRepeatFreq);s=!1};h();o=u?"mouseout.jsp":"mouseup.jsp";u=u||n("html");u.bind(o,function(){r.removeClass("jspActive");e&&clearTimeout(e);e=null;u.unbind(o)})}function ur(){ki();k&&g.bind("mousedown.jsp",function(t){if(t.originalTarget===i||t.originalTarget==t.currentTarget){var r,e=n(this),y=e.offset(),o=t.pageY-y.top-l,h=!0,a=function(){var p=e.offset(),n=t.pageY-p.top-et/2,i=s*f.scrollPagePercent,y=d*i/(v-s);if(0>o)l-y>n?c.scrollByY(-i):ht(n);else{if(!(o>0))return u(),void 0;n>l+y?c.scrollByY(i):ht(n)}r=setTimeout(a,h?f.initialDelay:f.trackClickRepeatFreq);h=!1},u=function(){r&&clearTimeout(r);r=null;n(document).unbind("mouseup.jsp",u)};return a(),n(document).bind("mouseup.jsp",u),!1}});b&&nt.bind("mousedown.jsp",function(t){if(t.originalTarget===i||t.originalTarget==t.currentTarget){var r,e=n(this),v=e.offset(),o=t.pageX-v.left-a,s=!0,l=function(){var p=e.offset(),n=t.pageX-p.left-ot/2,i=h*f.scrollPagePercent,v=ft*i/(y-h);if(0>o)a-v>n?c.scrollByX(-i):lt(n);else{if(!(o>0))return u(),void 0;n>a+v?c.scrollByX(i):lt(n)}r=setTimeout(l,s?f.initialDelay:f.trackClickRepeatFreq);s=!1},u=function(){r&&clearTimeout(r);r=null;n(document).unbind("mouseup.jsp",u)};return l(),n(document).bind("mouseup.jsp",u),!1}})}function ki(){nt&&nt.unbind("mousedown.jsp");g&&g.unbind("mousedown.jsp")}function di(){n("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp");p&&p.removeClass("jspActive");w&&w.removeClass("jspActive")}function ht(n,t){k&&(0>n?n=0:n>d&&(n=d),t===i&&(t=f.animateScroll),t?c.animate(p,"top",n,si):(p.css("top",n),si(n)))}function si(n){n===i&&(n=p.position().top);e.scrollTop(0);l=n;var t=0===l,u=l==d,h=n/d,f=-h*(v-s);(ri!=t||fi!=u)&&(ri=t,fi=u,r.trigger("jsp-arrow-change",[ri,fi,ui,ei]));fr(t,u);o.css("top",f);r.trigger("jsp-scroll-y",[-f,t,u]).trigger("scroll")}function lt(n,t){b&&(0>n?n=0:n>ft&&(n=ft),t===i&&(t=f.animateScroll),t?c.animate(w,"left",n,hi):(w.css("left",n),hi(n)))}function hi(n){n===i&&(n=w.position().left);e.scrollTop(0);a=n;var t=0===a,u=a==ft,s=n/ft,f=-s*(y-h);(ui!=t||ei!=u)&&(ui=t,ei=u,r.trigger("jsp-arrow-change",[ri,fi,ui,ei]));er(t,u);o.css("left",f);r.trigger("jsp-scroll-x",[-f,t,u]).trigger("scroll")}function fr(n,t){f.showArrows&&(wt[n?"addClass":"removeClass"]("jspDisabled"),bt[t?"addClass":"removeClass"]("jspDisabled"))}function er(n,t){f.showArrows&&(kt[n?"addClass":"removeClass"]("jspDisabled"),dt[t?"addClass":"removeClass"]("jspDisabled"))}function it(n,t){var i=n/(v-s);ht(i*d,t)}function at(n,t){var i=n/(y-h);lt(i*ft,t)}function gt(t,i,r){var u,v,y,p,w,b,k,l,a,o=0,c=0;try{u=n(t)}catch(d){return}for(v=u.outerHeight(),y=u.outerWidth(),e.scrollTop(0),e.scrollLeft(0);!u.is(".jspPane");)if(o+=u.position().top,c+=u.position().left,u=u.offsetParent(),/^body|html$/i.test(u[0].nodeName))return;p=ut();b=p+s;p>o||i?l=o-f.horizontalGutter:o+v>b&&(l=o-s+v+f.horizontalGutter);isNaN(l)||it(l,r);w=rt();k=w+h;w>c||i?a=c-f.horizontalGutter:c+y>k&&(a=c-h+y+f.horizontalGutter);isNaN(a)||at(a,r)}function rt(){return-o.position().left}function ut(){return-o.position().top}function or(){var n=v-s;return n>20&&n-ut()<10}function sr(){var n=y-h;return n>20&&n-rt()<10}function hr(){e.unbind(yi).bind(yi,function(n,t,i,r){var e=a,o=l,u=n.deltaFactor||f.mouseWheelSpeed;return c.scrollBy(i*u,-r*u,!1),e==a&&o==l})}function cr(){e.unbind(yi)}function vt(){return!1}function lr(){o.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(n){gt(n.target,!1)})}function ar(){o.find(":input,a").unbind("focus.jsp")}function vr(){function h(){var n=a,r=l;switch(t){case 40:c.scrollByY(f.keyboardSpeed,!1);break;case 38:c.scrollByY(-f.keyboardSpeed,!1);break;case 34:case 32:c.scrollByY(s*f.scrollPagePercent,!1);break;case 33:c.scrollByY(-s*f.scrollPagePercent,!1);break;case 39:c.scrollByX(f.keyboardSpeed,!1);break;case 37:c.scrollByX(-f.keyboardSpeed,!1)}return i=n!=a||r!=l}var t,i,u=[];b&&u.push(ii[0]);k&&u.push(ti[0]);o.focus(function(){r.focus()});r.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(r){if(r.target===this||u.length&&n(r.target).closest(u).length){var f=a,e=l;switch(r.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:t=r.keyCode;h();break;case 35:it(v-s);t=null;break;case 36:it(0);t=null}return i=r.keyCode==t&&f!=a||e!=l,!i}}).bind("keypress.jsp",function(n){return n.keyCode==t&&h(),!i});f.hideFocus?(r.css("outline","none"),"hideFocus"in e[0]&&r.attr("hideFocus",!0)):(r.css("outline",""),"hideFocus"in e[0]&&r.attr("hideFocus",!1))}function yr(){r.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp")}function pr(){if(location.hash&&location.hash.length>1){var t,r,i=escape(location.hash.substr(1));try{t=n("#"+i+', a[name="'+i+'"]')}catch(u){return}t.length&&o.find(i)&&(0===e.scrollTop()?r=setInterval(function(){e.scrollTop()>0&&(gt(t,!0),n(document).scrollTop(e.position().top),clearInterval(r))},50):(gt(t,!0),n(document).scrollTop(e.position().top)))}}function wr(){n(document.body).data("jspHijack")||(n(document.body).data("jspHijack",!0),n(document.body).delegate("a[href*=#]","click",function(i){var f,r,u,s,e,o,c=this.href.substr(0,this.href.indexOf("#")),h=location.href;if(-1!==location.href.indexOf("#")&&(h=location.href.substr(0,location.href.indexOf("#"))),c===h){f=escape(this.href.substr(this.href.indexOf("#")+1));try{r=n("#"+f+', a[name="'+f+'"]')}catch(l){return}r.length&&(u=r.closest(".jspScrollable"),s=u.data("jsp"),s.scrollToElement(r,!0),u[0].scrollIntoView&&(e=n(t).scrollTop(),o=r.offset().top,(e>o||o>e+n(t).height())&&u[0].scrollIntoView()),i.preventDefault())}}))}function br(){var u,f,t,i,n,r=!1;e.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(e){var o=e.originalEvent.touches[0];u=rt();f=ut();t=o.pageX;i=o.pageY;n=!1;r=!0}).bind("touchmove.jsp",function(e){if(r){var o=e.originalEvent.touches[0],s=a,h=l;return c.scrollTo(u+t-o.pageX,f+i-o.pageY),n=n||Math.abs(t-o.pageX)>5||Math.abs(i-o.pageY)>5,s==a&&h==l}}).bind("touchend.jsp",function(){r=!1}).bind("click.jsp-touchclick",function(){if(n)return(n=!1,!1)})}function kr(){var n=ut(),t=rt();r.removeClass("jspScrollable").unbind(".jsp");r.replaceWith(vi.append(o.children()));vi.scrollTop(n);vi.scrollLeft(t);pt&&clearInterval(pt)}var f,o,h,s,e,y,v,ci,ni,k,b,p,d,l,w,ft,a,ti,g,li,yt,et,wt,bt,ii,nt,ct,ot,kt,dt,pt,ai,st,gi,c=this,ri=!0,ui=!0,fi=!1,ei=!1,vi=r.clone(!1,!1).empty(),yi=n.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";"border-box"===r.css("box-sizing")?(ai=0,st=0):(ai=r.css("paddingTop")+" "+r.css("paddingRight")+" "+r.css("paddingBottom")+" "+r.css("paddingLeft"),st=(parseInt(r.css("paddingLeft"),10)||0)+(parseInt(r.css("paddingRight"),10)||0));n.extend(c,{reinitialise:function(t){t=n.extend({},f,t);oi(t)},scrollToElement:function(n,t,i){gt(n,t,i)},scrollTo:function(n,t,i){at(n,i);it(t,i)},scrollToX:function(n,t){at(n,t)},scrollToY:function(n,t){it(n,t)},scrollToPercentX:function(n,t){at(n*(y-h),t)},scrollToPercentY:function(n,t){it(n*(v-s),t)},scrollBy:function(n,t,i){c.scrollByX(n,i);c.scrollByY(t,i)},scrollByX:function(n,t){var i=rt()+Math[0>n?"floor":"ceil"](n),r=i/(y-h);lt(r*ft,t)},scrollByY:function(n,t){var i=ut()+Math[0>n?"floor":"ceil"](n),r=i/(v-s);ht(r*d,t)},positionDragX:function(n,t){lt(n,t)},positionDragY:function(n,t){ht(n,t)},animate:function(n,t,i,r){var u={};u[t]=i;n.animate(u,{duration:f.animateDuration,easing:f.animateEase,queue:!1,step:r})},getContentPositionX:function(){return rt()},getContentPositionY:function(){return ut()},getContentWidth:function(){return y},getContentHeight:function(){return v},getPercentScrolledX:function(){return rt()/(y-h)},getPercentScrolledY:function(){return ut()/(v-s)},getIsScrollableH:function(){return b},getIsScrollableV:function(){return k},getContentPane:function(){return o},scrollToBottom:function(n){ht(d,n)},hijackInternalLinks:n.noop,destroy:function(){kr()}});oi(u)}return r=n.extend({},n.fn.jScrollPane.defaults,r),n.each(["arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){r[this]=r[this]||r.speed}),this.each(function(){var t=n(this),i=t.data("jsp");i?i.reinitialise(r):(n("script",t).filter('[type="text/javascript"],:not([type])').remove(),i=new u(t,r),t.data("jsp",i))})};n.fn.jScrollPane.defaults={showArrows:!1,maintainPosition:!0,stickToBottom:!1,stickToRight:!1,clickOnTrack:!0,autoReinitialise:!1,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,contentWidth:i,animateScroll:!1,animateDuration:300,animateEase:"linear",hijackInternalLinks:!1,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:3,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:!1,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:!0,hideFocus:!1,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:.8}}(jQuery,this)