var DoubleSlider=new Class({Implements:[Events,Options],options:{range:[200,600],start:[0,0],mode:"horizontal",knobs:false},initialize:function(a,b){this.setOptions(b);this.element=document.id(a);var c,d={};switch(this.options.mode){case"vertical":this.axis=["y","x"];this.property="top";c="offsetHeight";break;case"horizontal":this.axis=["x","y"];this.property="left";c="offsetWidth"}var e=this.options.knobs===false?this.element.getElements("div"):this.element.getElements("."+this.options.knobs);this.knob_left=e[0];this.knob_right=e[1];this.full=this.element[c];this.knob_width=this.knob_left[c];this.range=this.full-this.knob_width;this.faktor=(this.options.range[1]-this.options.range[0])/(this.full-2*this.knob_width);this.options.start[0]=Math.round((this.options.start[0]-this.options.range[0])/this.faktor);this.options.start[1]=Math.round((this.options.start[1]-this.options.range[0])/this.faktor)+this.knob_width;var f=[0,0];f[0]=this.options.start[0]<0?0:this.options.start[0];f[1]=this.options.start[1]<=f[0]+this.knob_width?f[0]:this.options.start[1]-this.knob_width;this.knob_left.setStyle("position","relative").setStyle(this.property,f[0]);this.knob_right.setStyle("position","relative").setStyle(this.property,f[1]);this.initDrag()},initDrag:function(){var a={x:false,y:false};a[this.axis[0]]=this.property;var b={};b[this.axis[0]]=[0,this.knob_right.getStyle(this.property).toInt()];b[this.axis[1]]=[0,0];var c={limit:b,modifiers:a,onDrag:this.onDrag.bind(this),onBeforeStart:this.onStart.bind(this),onComplete:this.onComplete.bind(this)};this.drag_left=new Drag(this.knob_left,c);b[this.axis[0]]=[this.knob_left.getStyle(this.property).toInt(),this.range-this.knob_width];b[this.axis[1]]=[0,0];c.limit=b;this.drag_right=new Drag(this.knob_right,c)},getKnobValues:function(){var a={};a.knob_left=this.options.range[0]+Math.round(this.knob_left.getStyle(this.property).toInt()*this.faktor);a.knob_right=this.options.range[0]+Math.round(this.knob_right.getStyle(this.property).toInt()*this.faktor);return a},onDrag:function(a){this.updateKnobRange();this.fireEvent("change",this.getKnobValues())},onStart:function(a){this.updateKnobRange();this.fireEvent("start",this.getKnobValues())},onComplete:function(a){this.updateKnobRange();this.fireEvent("complete",this.getKnobValues())},updateKnobRange:function(){this.drag_left.options.limit[this.axis[0]]=[0,this.knob_right.getStyle(this.property).toInt()];this.drag_right.options.limit[this.axis[0]]=[this.knob_left.getStyle(this.property).toInt(),this.range-this.knob_width]}})
