Element.Events.extend({wheelup:{type:Element.Events.mousewheel.type,map:function(A){A=new Event(A);if(A.wheel>=0){this.fireEvent("wheelup",A)}}},wheeldown:{type:Element.Events.mousewheel.type,map:function(A){A=new Event(A);if(A.wheel<0){this.fireEvent("wheeldown",A)}}}});var ScrollControl=new Class({options:{createControls:false,htmlElementPrefix:"scrollcontroll_",wheelStepSize:15,scrollStepSize:3,controlOffset:10},initialize:function(G,D,H,B,A,C){this.setOptions(D);if(window.opera){this.options.wheelStepSize*=-1}this.contentElement=G;this.createContainers();if(this.options.createControls){this.createControls()}else{this.scrollUpBtn=A.injectInside(this.scrollContainer);this.scrollTrack=H.injectAfter(this.scrollUpBtn).setStyle("display","block");this.scrollKnob=B;this.scrollDownBtn=C.injectAfter(this.scrollTrack)}var E=this.scrollTrack.getCoordinates()["height"];var F=this.contentElement.getCoordinates()["height"];this.scrollKnob.setStyle("height",Math.round(Math.pow(E,2)/F));this.currentStep=0;this.scrollHeight=F-E;this.contentElement.setStyles({width:(this.contentElement.getCoordinates()["width"]-(this.scrollTrack.getCoordinates()["width"]+this.options.controlOffset))+"px",position:"absolute"});if(this.contentElement.getCoordinates()["height"]<this.scrollTrack.getCoordinates()["height"]){this.scrollKnob.setStyle("display","none");return }this.mySlide=new Slider(this.scrollTrack,this.scrollKnob,{steps:this.scrollHeight,mode:"vertical",onChange:this.refresh.bind(this)});if($defined(this.scrollUpBtn)){this.scrollUpBtn.addEvents({mousedown:this.startScrolling.bind(this,"up"),mouseup:this.stopScrolling.bind(this),mouseout:this.stopScrolling.bind(this)}).setStyle("display","block")}if($defined(this.scrollDownBtn)){this.scrollDownBtn.addEvents({mousedown:this.startScrolling.bind(this,"down"),mouseup:this.stopScrolling.bind(this),mouseout:this.stopScrolling.bind(this)}).setStyle("display","block")}this.contentElement.addEvents({wheelup:this.doWheelUp.bind(this),wheeldown:this.doWheelDown.bind(this)})},createContainers:function(){var A=new Element("div",{id:this.options.htmlElementPrefix+"contentmask"}).injectBefore(this.contentElement).adopt(this.contentElement);this.contentElement.setStyles({overflow:"visible","margin-top":"0",height:"auto"});this.scrollContainer=new Element("div",{id:this.options.htmlElementPrefix+"scrollcontainer"}).injectAfter(A).setStyle("display","block")},createControls:function(){this.scrollUpBtn=new Element("div",{id:this.options.htmlElementPrefix+"scrollUpBtn"}).injectInside(this.scrollContainer);this.scrollTrack=new Element("div",{id:this.options.htmlElementPrefix+"scrolltrack"}).injectAfter(this.scrollUpBtn);this.scrollKnob=new Element("div",{id:this.options.htmlElementPrefix+"scrollknob"}).injectInside(this.scrollTrack);this.scrollDownBtn=new Element("div",{id:this.options.htmlElementPrefix+"scrollDownBtn"}).injectAfter(this.scrollTrack)},doWheelUp:function(A){new Event(A).stop();this.scrollUp(this.options.wheelStepSize)},doWheelDown:function(A){new Event(A).stop();this.scrollDown(this.options.wheelStepSize)},startScrolling:function(A){if(A=="up"){this.scrollIntervall=this.scrollUp.periodical(50,this,this.options.scrollStepSize)}else{this.scrollIntervall=this.scrollDown.periodical(50,this,this.options.scrollStepSize)}},stopScrolling:function(){$clear(this.scrollIntervall)},refresh:function(A){if(A==this.currentStep){return }A=Math.round(A.toInt().limit(0,this.scrollHeight));this.mySlide.set(A);this.currentStep=A;this.contentElement.setStyle("top",-A)},scrollUp:function(A){this.refresh(this.currentStep-A)},scrollDown:function(A){this.refresh(this.currentStep+A)}});ScrollControl.implement(new Options);
