var ScrollBar=new Class({Extends:Slider,options:{scroll:{wheelStops:false},slider:{mode:"horizontal",wheel:true},knob:{}},initialize:function(b,d,a,c){this.knob=document.id(a).set("tween",c.knob);this.slider=document.id(d);this.scroller=document.id(b);this.scrollElement=this.scroller.getFirst();this.parent(this.slider,this.knob,$extend(this.options.slider,c.slider));this.steps=this.scrollElement.getSize()[this.axis]-this.scroller.getSize()[this.axis];this.scroll=new Fx.Scroll(this.scroller,$extend(this.options.scroll,c.scroll));this.scroller.addEvent("mousewheel",function(e){this.element.fireEvent("mousewheel",e)}.bind(this));this.ratio=this.steps/(this.slider.getSize()[this.axis]-this.knob.getSize()[this.axis])},move2:function(a){this.set(this.knob.getPosition(this.slider)[this.axis]+a)},set:function(a){if($type(a)==="element"){a=a.getPosition(this.scrollElement)[this.axis]/this.ratio}a=a.limit(-this.options.offset,this.full-this.options.offset);this.move(a*this.ratio);this.knob.tween(this.property,a).get("tween").chain(function(){this.fireEvent("complete",Math.round(a*this.ratio)+"")}.bind(this))},move:function(a){var b=$chk(a)?a:this.step;if(this.options.mode==="vertical"){this.scroll.cancel().start(0,b)}else{this.scroll.cancel().start(b,0)}},draggedKnob:function(){this.parent();if(this.options.mode==="vertical"){this.scroll.cancel().set(0,this.step)}else{this.scroll.cancel().set(this.step)}},clickedElement:function(b){if(b.target===this.knob){this.knob.get("tween").cancel();return}var a=b.page[this.axis]-this.element.getPosition()[this.axis]-this.half;a=a.limit(-this.options.offset,this.full-this.options.offset);this.set(a)},scrolledElement:function(a){var b=(this.options.mode=="horizontal")?(a.wheel<0):(a.wheel>0);this.move2(b?-this.stepSize*100:this.stepSize*100);a.stop()}});