(function(d,Ja,I){d.fn.jScrollPane=function(J){function ya(g,P){function ga(a){var b,c,f,h,i;e=a;if(l===I){h=g.scrollTop();i=g.scrollLeft();g.css({overflow:"hidden",padding:0});n=g.innerWidth()+K;m=g.innerHeight();g.width(n);l=d('<div class="jspPane" />').css("padding",pa).append(g.children());k=d('<div class="jspContainer" />').css({width:n+"px",height:m+"px"}).append(l).appendTo(g)}else{g.css("width","");if(a=g.innerWidth()+K!=n||g.outerHeight()!=m){n=g.innerWidth()+K;m=g.innerHeight();k.css({width:n+
"px",height:m+"px"})}if(!a&&qa==x&&l.outerHeight()==t){g.width(n);return}qa=x;l.css("width","");g.width(n);k.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}a=l.clone(false,false).css("position","absolute");b=d('<div style="width:1px; position: relative;" />').append(a);d("body").append(b);x=Math.max(l.outerWidth(),a.outerWidth());b.remove();t=l.outerHeight();ha=x/n;$=t/m;y=$>1;if((z=ha>1)||y){g.addClass("jspScrollable");if(a=e.maintainPosition&&(q||r)){c=L();f=M()}za();Aa();Ba();if(a){Q(c,
false);D(f,false)}Ca();Da();Ea();e.enableKeyboardNavigation&&Fa();e.clickOnTrack&&Ga();Ha();e.hijackInternalLinks&&ra()}else{g.removeClass("jspScrollable");l.css({top:0,width:k.width()-K});k.unbind(ia);l.find(":input,a").unbind("focus.jsp");g.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp");sa();ta()}if(e.autoReinitialise&&!aa)aa=setInterval(function(){ga(e)},e.autoReinitialiseDelay);else!e.autoReinitialise&&aa&&clearInterval(aa);h&&g.scrollTop(0)&&D(h,false);i&&g.scrollLeft(0)&&
Q(i,false);g.trigger("jsp-initialised",[z||y]);d(".jspPane").css("height",d(".jspPane").parent().css("height"))}function za(){if(y){k.append(d('<div class="jspVerticalBar" />').append(d('<div class="jspCap jspCapTop" />'),d('<div class="jspTrack" />').append(d('<div class="jspDrag" />').append(d('<div class="jspDragTop" />'),d('<div class="jspDragBottom" />'))),d('<div class="jspCap jspCapBottom" />')));ja=k.find(">.jspVerticalBar");A=ja.find(">.jspTrack");u=A.find(">.jspDrag");if(e.showArrows){V=
d('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp",E(0,-1)).bind("click.jsp",R);W=d('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp",E(0,1)).bind("click.jsp",R);if(e.arrowScrollOnHover){V.bind("mouseover.jsp",E(0,-1,V));W.bind("mouseover.jsp",E(0,1,W))}ua(A,e.verticalArrowPositions,V,W)}S=m;k.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){S-=d(this).outerHeight()});u.hover(function(){u.addClass("jspHover")},function(){u.removeClass("jspHover")}).bind("mousedown.jsp",
function(a){d("html").bind("dragstart.jsp selectstart.jsp",R);u.addClass("jspActive");var b=a.pageY-u.position().top;d("html").bind("mousemove.jsp",function(c){T(c.pageY-b,false)}).bind("mouseup.jsp mouseleave.jsp",va);return false});wa()}}function wa(){A.height(S+"px");q=0;ka=e.verticalGutter+A.outerWidth();l.width(n-ka-K);ja.position().left===0&&l.css("margin-left",ka+"px")}function Aa(){if(z){k.append(d('<div class="jspHorizontalBar" />').append(d('<div class="jspCap jspCapLeft" />'),d('<div class="jspTrack" />').append(d('<div class="jspDrag" />').append(d('<div class="jspDragLeft" />'),
d('<div class="jspDragRight" />'))),d('<div class="jspCap jspCapRight" />')));la=k.find(">.jspHorizontalBar");B=la.find(">.jspTrack");v=B.find(">.jspDrag");if(e.showArrows){X=d('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp",E(-1,0)).bind("click.jsp",R);Y=d('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp",E(1,0)).bind("click.jsp",R);if(e.arrowScrollOnHover){X.bind("mouseover.jsp",E(-1,0,X));Y.bind("mouseover.jsp",E(1,0,Y))}ua(B,e.horizontalArrowPositions,X,Y)}v.hover(function(){v.addClass("jspHover")},
function(){v.removeClass("jspHover")}).bind("mousedown.jsp",function(a){d("html").bind("dragstart.jsp selectstart.jsp",R);v.addClass("jspActive");var b=a.pageX-v.position().left;d("html").bind("mousemove.jsp",function(c){N(c.pageX-b,false)}).bind("mouseup.jsp mouseleave.jsp",va);return false});O=k.innerWidth();xa()}}function xa(){k.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){O-=d(this).outerWidth()});B.width(O+"px");r=0}function Ba(){if(z&&y){var a=B.outerHeight(),
b=A.outerWidth();S-=a;d(la).find(">.jspCap:visible,>.jspArrow").each(function(){O+=d(this).outerWidth()});O-=b;m-=b;n-=a;B.parent().append(d('<div class="jspCorner" />').css("width",a+"px"));wa();xa()}z&&l.width(k.outerWidth()-K+"px");t=l.outerHeight();$=t/m;if(z){F=Math.ceil(1/ha*O);if(F>e.horizontalDragMaxWidth)F=e.horizontalDragMaxWidth;else if(F<e.horizontalDragMinWidth)F=e.horizontalDragMinWidth;v.width(F+"px");G=O-F;ma(r)}if(y){H=Math.ceil(1/$*S);if(H>e.verticalDragMaxHeight)H=e.verticalDragMaxHeight;
else if(H<e.verticalDragMinHeight)H=e.verticalDragMinHeight;u.height(H+"px");C=S-H;na(q)}}function ua(a,b,c,f){var h="before",i="after";if(b=="os")b=/Mac/.test(navigator.platform)?"after":"split";if(b==h)i=b;else if(b==i){h=b;b=c;c=f;f=b}a[h](c)[i](f)}function E(a,b,c){return function(){Ia(a,b,this,c);this.blur();return false}}function Ia(a,b,c,f){c=d(c).addClass("jspActive");var h,i,j=true,s=function(){a!==0&&p.scrollByX(a*e.arrowButtonSpeed);b!==0&&p.scrollByY(b*e.arrowButtonSpeed);i=setTimeout(s,
j?e.initialDelay:e.arrowRepeatFreq);j=false};s();h=f?"mouseout.jsp":"mouseup.jsp";f=f||d("html");f.bind(h,function(){c.removeClass("jspActive");i&&clearTimeout(i);i=null;f.unbind(h)})}function Ga(){sa();y&&A.bind("mousedown.jsp",function(a){if(a.originalTarget===I||a.originalTarget==a.currentTarget){var b=d(this),c=b.offset(),f=a.pageY-c.top-q,h,i=true,j=function(){var o=b.offset();o=a.pageY-o.top-H/2;var w=m*e.scrollPagePercent,U=C*w/(t-m);if(f<0)q-U>o?p.scrollByY(-w):T(o);else if(f>0)q+U<o?p.scrollByY(w):
T(o);else{s();return}h=setTimeout(j,i?e.initialDelay:e.trackClickRepeatFreq);i=false},s=function(){h&&clearTimeout(h);h=null;d(document).unbind("mouseup.jsp",s)};j();d(document).bind("mouseup.jsp",s);return false}});z&&B.bind("mousedown.jsp",function(a){if(a.originalTarget===I||a.originalTarget==a.currentTarget){var b=d(this),c=b.offset(),f=a.pageX-c.left-r,h,i=true,j=function(){var o=b.offset();o=a.pageX-o.left-F/2;var w=n*e.scrollPagePercent,U=G*w/(x-n);if(f<0)r-U>o?p.scrollByX(-w):N(o);else if(f>
0)r+U<o?p.scrollByX(w):N(o);else{s();return}h=setTimeout(j,i?e.initialDelay:e.trackClickRepeatFreq);i=false},s=function(){h&&clearTimeout(h);h=null;d(document).unbind("mouseup.jsp",s)};j();d(document).bind("mouseup.jsp",s);return false}})}function sa(){B&&B.unbind("mousedown.jsp");A&&A.unbind("mousedown.jsp")}function va(){d("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp");u&&u.removeClass("jspActive");v&&v.removeClass("jspActive")}function T(a,b){if(y){if(a<
0)a=0;else if(a>C)a=C;if(b===I)b=e.animateScroll;if(b)p.animate(u,"top",a,na);else{u.css("top",a);na(a)}}}function na(a){if(a===I)a=u.position().top;k.scrollTop(0);q=a;var b=q===0,c=q==C;a=-(a/C)*(t-m);if(ba!=b||ca!=c){ba=b;ca=c;g.trigger("jsp-arrow-change",[ba,ca,da,ea])}if(e.showArrows){V[b?"addClass":"removeClass"]("jspDisabled");W[c?"addClass":"removeClass"]("jspDisabled")}l.css("top",a);g.trigger("jsp-scroll-y",[-a,b,c]).trigger("scroll")}function N(a,b){if(z){if(a<0)a=0;else if(a>G)a=G;if(b===
I)b=e.animateScroll;if(b)p.animate(v,"left",a,ma);else{v.css("left",a);ma(a)}}}function ma(a){if(a===I)a=v.position().left;k.scrollTop(0);r=a;var b=r===0,c=r==G;a=-(a/G)*(x-n);if(da!=b||ea!=c){da=b;ea=c;g.trigger("jsp-arrow-change",[ba,ca,da,ea])}if(e.showArrows){X[b?"addClass":"removeClass"]("jspDisabled");Y[c?"addClass":"removeClass"]("jspDisabled")}l.css("left",a);g.trigger("jsp-scroll-x",[-a,b,c]).trigger("scroll")}function D(a,b){T(a/(t-m)*C,b)}function Q(a,b){N(a/(x-n)*G,b)}function Z(a,b,c){var f,
h,i=0,j=0,s,o,w;try{f=d(a)}catch(U){return}h=f.outerHeight();a=f.outerWidth();k.scrollTop(0);for(k.scrollLeft(0);!f.is(".jspPane");){i+=f.position().top;j+=f.position().left;f=f.offsetParent();if(/^body|html$/i.test(f[0].nodeName))return}f=M();s=f+m;if(i<f||b)o=i-e.verticalGutter;else if(i+h>s)o=i-m+h+e.verticalGutter;o&&D(o,c);viewportLeft=L();i=viewportLeft+n;if(j<viewportLeft||b)w=j-e.horizontalGutter;else if(j+a>i)w=j-n+a+e.horizontalGutter;w&&Q(w,c)}function L(){return-l.position().left}function M(){return-l.position().top}
function Da(){k.unbind(ia).bind(ia,function(a,b,c,f){a=r;b=q;p.scrollBy(c*e.mouseWheelSpeed,-f*e.mouseWheelSpeed,false);return a==r&&b==q})}function R(){return false}function Ca(){l.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(a){Z(a.target,false)})}function Fa(){function a(){var f=r,h=q;switch(b){case 40:p.scrollByY(e.keyboardSpeed,false);break;case 38:p.scrollByY(-e.keyboardSpeed,false);break;case 34:case 32:p.scrollByY(m*e.scrollPagePercent,false);break;case 33:p.scrollByY(-m*
e.scrollPagePercent,false);break;case 39:p.scrollByX(e.keyboardSpeed,false);break;case 37:p.scrollByX(-e.keyboardSpeed,false)}return c=f!=r||h!=q}var b,c;l.focus(function(){g.focus()});g.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(f){if(f.target===this){var h=r,i=q;switch(f.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:b=f.keyCode;a();break;case 35:D(t-m);b=null;break;case 36:D(0);b=null}c=f.keyCode==b&&h!=r||i!=q;return!c}}).bind("keypress.jsp",
function(f){f.keyCode==b&&a();return!c});if(e.hideFocus){g.css("outline","none");"hideFocus"in k[0]&&g.attr("hideFocus",true)}else{g.css("outline","");"hideFocus"in k[0]&&g.attr("hideFocus",false)}}function Ha(){if(location.hash&&location.hash.length>1){var a,b;try{a=d(location.hash)}catch(c){return}if(a.length&&l.find(location.hash))if(k.scrollTop()===0)b=setInterval(function(){if(k.scrollTop()>0){Z(location.hash,true);d(document).scrollTop(k.position().top);clearInterval(b)}},50);else{Z(location.hash,
true);d(document).scrollTop(k.position().top)}}}function ta(){d("a.jspHijack").unbind("click.jsp-hijack").removeClass("jspHijack")}function ra(){ta();d("a[href^=#]").addClass("jspHijack").bind("click.jsp-hijack",function(){var a=this.href.split("#");if(a.length>1){a=a[1];if(a.length>0&&l.find("#"+a).length>0){Z("#"+a,true);return false}}})}function Ea(){var a,b,c,f,h,i=false;k.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(j){j=j.originalEvent.touches[0];
a=L();b=M();c=j.pageX;f=j.pageY;h=false;i=true}).bind("touchmove.jsp",function(j){if(i){j=j.originalEvent.touches[0];var s=r,o=q;p.scrollTo(a+c-j.pageX,b+f-j.pageY);h=h||Math.abs(c-j.pageX)>5||Math.abs(f-j.pageY)>5;return s==r&&o==q}}).bind("touchend.jsp",function(){i=false}).bind("click.jsp-touchclick",function(){if(h)return h=false})}var e,p=this,l,n,m,k,x,t,ha,$,y,z,u,C,q,v,G,r,ja,A,ka,S,H,V,W,la,B,O,F,X,Y,aa,pa,K,qa,ba=true,da=true,ca=false,ea=false,oa=g.clone(false,false).empty(),ia=d.fn.mwheelIntent?
"mwheelIntent.jsp":"mousewheel.jsp";pa=g.css("paddingTop")+" "+g.css("paddingRight")+" "+g.css("paddingBottom")+" "+g.css("paddingLeft");K=(parseInt(g.css("paddingLeft"),10)||0)+(parseInt(g.css("paddingRight"),10)||0);d.extend(p,{reinitialise:function(a){a=d.extend({},e,a);ga(a)},scrollToElement:function(a,b,c){Z(a,b,c)},scrollTo:function(a,b,c){Q(a,c);D(b,c)},scrollToX:function(a,b){Q(a,b)},scrollToY:function(a,b){D(a,b)},scrollToPercentX:function(a,b){Q(a*(x-n),b)},scrollToPercentY:function(a,b){D(a*
(t-m),b)},scrollBy:function(a,b,c){p.scrollByX(a,c);p.scrollByY(b,c)},scrollByX:function(a,b){var c=(L()+a)/(x-n);N(c*G,b)},scrollByY:function(a,b){var c=(M()+a)/(t-m);T(c*C,b)},positionDragX:function(a,b){N(a,b)},positionDragY:function(a,b){N(a,b)},animate:function(a,b,c,f){var h={};h[b]=c;a.animate(h,{duration:e.animateDuration,ease:e.animateEase,queue:false,step:f})},getContentPositionX:function(){return L()},getContentPositionY:function(){return M()},getContentWidth:function(){return x()},getContentHeight:function(){return t()},
getPercentScrolledX:function(){return L()/(x-n)},getPercentScrolledY:function(){return M()/(t-m)},getIsScrollableH:function(){return z},getIsScrollableV:function(){return y},getContentPane:function(){return l},scrollToBottom:function(a){T(C,a)},hijackInternalLinks:function(){ra()},destroy:function(){var a=M(),b=L();g.removeClass("jspScrollable").unbind(".jsp");g.replaceWith(oa.append(l.children()));oa.scrollTop(a);oa.scrollLeft(b)}});ga(P)}J=d.extend({},d.fn.jScrollPane.defaults,J);d.each(["mouseWheelSpeed",
"arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){J[this]=J[this]||J.speed});var fa;this.each(function(){var g=d(this),P=g.data("jsp");if(P)P.reinitialise(J);else{P=new ya(g,J);g.data("jsp",P)}fa=fa?fa.add(g):g});return fa};d.fn.jScrollPane.defaults={showArrows:false,maintainPosition:true,clickOnTrack:true,autoReinitialise:false,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,animateScroll:false,animateDuration:300,
animateEase:"linear",hijackInternalLinks:false,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:0,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:false,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:true,hideFocus:false,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:0.8}})(jQuery,this);
