var Caption = new Class({
  initialize:function(caption_div){
    this.caption = $(caption_div);
    this.caption_fx = new Fx.Styles($(caption_div),{duration:500});
  },
  change_caption:function(cap){
    var fx = this.caption_fx;
    this.caption.setHTML("<span>"+cap+"</span>");
    this.caption_fx.stop();
    this.caption_fx.start({
      'width':400,
      'padding-left':7,
      'padding-right':7
    });
  },
  switch_caption:function(caption){
    if (this.caption.getStyle('width') == '400px') {
      timer = $clear(timer);
      timer = this.change_caption.delay(1000,this,caption);
      our_caption_fx = this.caption_fx;
      our_caption_fx.start({
        'width':0,
        'padding-left':0,
        'padding-right':0
      });
    } else {
      this.change_caption(caption);
    }
  }
});
