var ModeManager=new Class({options:{onModeChange:Class.empty,initial_mode:null},initialize:function(B,A){console.assert($type(B)=="array","modes must be a sequence");console.assert(B.length>0,"modes must be a non-empty sequence");this.setOptions(A);this.legal_modes=B;this.current_mode=(this.options.initial_mode||B[0])},setMode:function(B){console.assert(this.legal_modes.contains(B),'mode "'+String(B)+'" was not in legal modes');var A=this.current_mode;this.current_mode=B;this.fireEvent("onModeChange",[this.current_mode,A],0)},getMode:function(){return this.current_mode}});ModeManager.implement(new Events,new Options)
