(function(a){a.jScrollPane={active:[]};a.fn.jScrollPane=function(c){c=a.extend({},a.fn.jScrollPane.defaults,c);var k=function(){return false};return this.each(function(){var d=a(this);d.css("overflow","hidden");var I=this;if(a(this).parent().is(".jScrollPaneContainer")){var J=c.maintainPosition?d.position().top:0,h=a(this).parent(),i=h.innerWidth(),f=h.outerHeight(),n=f;a(">.jScrollPaneTrack, >.jScrollArrowUp, >.jScrollArrowDown",h).remove();d.css({top:0})}else{J=0;this.originalPadding=d.css("paddingTop")+
" "+d.css("paddingRight")+" "+d.css("paddingBottom")+" "+d.css("paddingLeft");this.originalSidePaddingTotal=(parseInt(d.css("paddingLeft"))||0)+(parseInt(d.css("paddingRight"))||0);i=d.innerWidth();n=f=d.innerHeight();d.wrap(a("<div></div>").attr({className:"jScrollPaneContainer"}).css({height:f+"px",width:i+"px"}));a(document).bind("emchange",function(){d.jScrollPane(c)})}if(c.reinitialiseOnImageLoad){var q=a.data(I,"jScrollPaneImagesToLoad")||a("img",d),K=[];q.length&&q.each(function(b,e){a(this).bind("load",
function(){if(a.inArray(b,K)==-1){K.push(e);q=a.grep(q,function(g){return g!=e});a.data(I,"jScrollPaneImagesToLoad",q);c.reinitialiseOnImageLoad=false;d.jScrollPane(c)}}).each(function(){if(this.complete||this.complete===undefined)this.src=this.src})})}h={height:"auto",width:i-c.scrollbarWidth-c.scrollbarMargin-this.originalSidePaddingTotal+"px"};if(c.scrollbarOnLeft)h.paddingLeft=c.scrollbarMargin+c.scrollbarWidth+"px";else h.paddingRight=c.scrollbarMargin+"px";d.css(h);var s=d.outerHeight(),t=f/
s;if(t<0.99){var l=d.parent();l.append(a("<div></div>").attr({className:"jScrollPaneTrack"}).css({width:c.scrollbarWidth+"px"}).append(a("<div></div>").attr({className:"jScrollPaneDrag"}).css({width:c.scrollbarWidth+"px"}).append(a("<div></div>").attr({className:"jScrollPaneDragTop"}).css({width:c.scrollbarWidth+"px"}),a("<div></div>").attr({className:"jScrollPaneDragBottom"}).css({width:c.scrollbarWidth+"px"}))));i=a(">.jScrollPaneTrack",l);var u=a(">.jScrollPaneTrack .jScrollPaneDrag",l);if(c.showArrows){var v,
B,L,w,M=function(){if(w>4||w%4==0)o(j+B*X);w++},N=function(){a("html").unbind("mouseup",N);v.removeClass("jScrollActiveArrowButton");clearInterval(L)},O=function(){a("html").bind("mouseup",N);v.addClass("jScrollActiveArrowButton");w=0;M();L=setInterval(M,100)};l.append(a("<a></a>").attr({href:"javascript:;",className:"jScrollArrowUp"}).css({width:c.scrollbarWidth+"px"}).html("Scroll up").bind("mousedown",function(){v=a(this);B=-1;O();this.blur();return false}).bind("click",k),a("<a></a>").attr({href:"javascript:;",
className:"jScrollArrowDown"}).css({width:c.scrollbarWidth+"px"}).html("Scroll down").bind("mousedown",function(){v=a(this);B=1;O();this.blur();return false}).bind("click",k));var P=a(">.jScrollArrowUp",l),Q=a(">.jScrollArrowDown",l);if(c.arrowSize){n=f-c.arrowSize-c.arrowSize;i.css({height:n+"px",top:c.arrowSize+"px"})}else{h=P.height();c.arrowSize=h;n=f-h-Q.height();i.css({height:n+"px",top:h+"px"})}}var C=a(this).css({position:"absolute",overflow:"visible"}),r,m,X,j=0,x=t*f/2,D=function(b,e){var g=
e=="X"?"Left":"Top";return b["page"+e]||b["client"+e]+(document.documentElement["scroll"+g]||document.body["scroll"+g])||0},y=function(){return false},F=function(){E();r=u.offset(false);r.top-=j;m=n-u[0].offsetHeight;mouseWheelMultipliermouseWheelMultiplier=2*c.wheelSpeed*m/s},R=function(){a("html").unbind("mouseup",R).unbind("mousemove",S);x=t*f/2;a.browser.msie&&a("html").unbind("dragstart",y).unbind("selectstart",y)},o=function(b){j=b=b<0?0:b>m?m:b;u.css({top:b+"px"});C.css({top:(f-s)*(b/m)+"px"});
d.trigger("scroll");if(c.showArrows){P[b==0?"addClass":"removeClass"]("disabled");Q[b==m?"addClass":"removeClass"]("disabled")}},S=function(b){o(D(b,"Y")-r.top-x)};u.css({height:Math.max(Math.min(t*(f-c.arrowSize*2),c.dragMaxHeight),c.dragMinHeight)+"px"}).bind("mousedown",function(b){F();x=D(b,"Y")-j-r.top;a("html").bind("mouseup",R).bind("mousemove",S);a.browser.msie&&a("html").bind("dragstart",y).bind("selectstart",y);return false});var T,z,U,V=function(){if(z>8||z%4==0)o(j-(j-U)/2);z++},W=function(){clearInterval(T);
a("html").unbind("mouseup",W).unbind("mousemove",G)},G=function(b){U=D(b,"Y")-r.top-x};i.bind("mousedown",function(b){F();G(b);z=0;a("html").bind("mouseup",W).bind("mousemove",G);T=setInterval(V,100);V()});var A,H,Y=function(){var b=(A-j)/c.animateStep;if(b>1||b<-1)o(j+b);else{o(A);E()}},E=function(){if(H){clearInterval(H);delete A}},p=function(b,e){if(typeof b=="string"){$e=a(b,d);if(!$e.length)return;b=$e.offset().top-d.offset().top}l.scrollTop(0);E();var g=-b/(f-s)*m;if(e||!c.animateTo)o(g);else{A=
g;H=setInterval(Y,c.animateInterval)}};d[0].scrollTo=p;d[0].scrollBy=function(b){var e=-parseInt(C.css("top"))||0;p(e+b)};F();p(-J,true);a("*",this).bind("focus",function(){for(var b=a(this),e=0;b[0]!=d[0];){e+=b.position().top;b=b.offsetParent()}b=-parseInt(C.css("top"))||0;var g=b+f;if(!(e>b&&e<g)){g=e-c.scrollbarMargin;if(e>b)g+=a(this).height()+15+c.scrollbarMargin-f;p(g)}});location.hash&&p(location.hash);a(document).bind("click",function(b){$target=a(b.target);if($target.is("a")){b=$target.attr("href");
b.substr(0,1)=="#"&&p(b)}});a.jScrollPane.active.push(d[0])}else{d.css({height:f+"px",width:i-this.originalSidePaddingTotal+"px",padding:this.originalPadding});d.parent().unbind("mousewheel")}})};a.fn.jScrollPane.defaults={scrollbarWidth:10,scrollbarMargin:5,wheelSpeed:18,showArrows:false,arrowSize:0,animateTo:false,dragMinHeight:1,dragMaxHeight:99999,animateInterval:100,animateStep:3,maintainPosition:true,scrollbarOnLeft:false,reinitialiseOnImageLoad:false};a(window).bind("unload",function(){for(var c=
a.jScrollPane.active,k=0;k<c.length;k++)c[k].scrollTo=c[k].scrollBy=null})})(jQuery);

