this.TextSlider = Class.create({
  text:null,
  elm:null,
  left:null,
  right:null,
  width:0,
  
  initialize: function( text, elm )
  {
    this.text = text;
    this.elm = elm;
    this.width = parseInt( jQuery(this.elm).css("width") );
    setInterval( delegate(this, this.update), 1000 / 12 );
  },
  
  drawText: function()
  {
    var id = new Date().getTime() + Math.floor( Math.random() * 1000 );
    var txt = "<span id='" + id + "'>" + this.text + "</span>";
    jQuery(this.elm).append( txt );
    return jQuery( "#" + id );
  },
  
  update: function()
  {
    var speed = 3;
    
    if( this.left ) jQuery(this.left).css( "left", ( parseInt( jQuery(this.left).css("left") ) - speed ) + "px" );
    if( this.right ) jQuery(this.right).css( "left", ( parseInt( jQuery(this.right).css("left") ) - speed ) + "px" );
    
    if( !this.left )
    {
      if( !this.right ) this.right = this.drawText();
      this.left = this.right;
      this.right = this.drawText();
      this.right.css( "left", parseInt( jQuery(this.left).css("left") ) + this.right.width() + 20 );
    }
    else if( parseInt( jQuery(this.left).css("left") ) < -this.left.width() )
    {
      jQuery(this.elm).remove( this.left );
      this.left = null;
    }
  }
  
});
