var clrzMachinegun=new Class({Implements:[Options,Events],options:{elt:"",fps:24,length:800},initialize:function(b){this.setOptions(b);this.element=$(this.options.elt);this.width=this.element.getStyle("width").toInt();this.speed=(1000/this.options.fps);this.pos=0;this.frame=1;this.lastFrame=(this.options.length/this.width);this.direction=0},setDirection:function(b){if(b){this.direction=b}return this},play:function(){this.moove();this.timer=this.moove.periodical(this.speed,this);this.fireEvent("play");return this},stop:function(){$clear(this.timer);this.fireEvent("stop");return this},rewind:function(){this.pos=0;this.element.setStyle("background-position","0px 0");return this},end:function(){this.stop();this.fireEvent("end");return this},moove:function(){this.pos=this.pos+this.width;this.frame=(this.pos/this.width);if(this.frame==(this.lastFrame)){this.end();return}var b=(this.direction==0)?"-":"";this.element.setStyle("background-position",b+this.pos+"px 0")}});
