var Slide = Class.create({
  /**
   * Initialize the slide
   *
   * @param frames Array[Element]
   * @param step Numeric
   */
  initialize: function (frames, step) {
    this.frames = frames;
    this.step = step || 10;
    
    this.setup();
  },
  
  /**
   * Show next slide
   */
  show: function () {
    if (!this.current) {
      this.current = this.frames.first();
    }

    var next = (this.frames.indexOf(this.current) + 1) % this.frames.length;
        
    this.current.fade();
    this.current = this.frames[next].appear();
  },
  
  /**
   * Setup the periodical executer
   */
  setup: function () {
    this.timer = new PeriodicalExecuter(this.show.bind(this), this.step);
  }
});
