  var NewsTicker = new Class({
    _ticker: null,
    _max_pos: 0,
    _offset: 2,
    _enabled: true,

    initialize: function(ticker)
    {
      this._ticker = ticker;

      this._ticker.scrollTo(0,0);

      var data = this._ticker.getSize();
      this._max_pos = data.scrollSize.y - data.size.y;

      this._ticker.addEvent('mouseover',this.onMouseIn.bind(this));
      this._ticker.addEvent('mouseout',this.onMouseOut.bind(this));

      setInterval(this.advance.bind(this),100);
    },

    advance: function()
    {
      if(!this._enabled) return;

      var pos = (this._ticker.getSize()).scroll.y;
      if(pos >= this._max_pos || pos <= 0) this._offset = -this._offset;

      this._ticker.scrollTo(0,pos+this._offset);
    },

    onMouseIn: function(e)
    {
      this._enabled = false;
    },

    onMouseOut: function(e)
    {
      this._enabled = true;
    }
  });

    window.addEvent('load', function(){
      var news_ticker = new NewsTicker($('ticker_content'));
    });
