var Rotate = new Class({
    initialize: function() {
        this.strip = document.getElement('#film');
        this.stripSize = this.strip.getChildren().length;
        this.position = 1;
        
        var images = document.getElements('#film img');
        var that = this;
        images.each(function(image) {
            image.addEvent('mouseover', function(){
                that.timeout = $clear(that.timeout);
            });
           
            image.addEvent('mouseout', function(){
                that.timeout = that.doRotate.delay(1000, that); 
            });
        });
        
        this.timeout = this.doRotate.delay(5000, this);
    },
    
    doRotate: function() {        
        if(this.position < this.stripSize) {
            new Fx.Styles(this.strip, {duration:1100}).start({'right':this.position * 780});
            this.position++;
        } else {
            new Fx.Styles(this.strip, {duration:this.stripSize * 100}).start({'right':0});
            this.position = 1;
        }
        this.timeout = this.doRotate.delay(5000, this);
    }
});