var Ticker = Class.create();
Ticker.prototype = {
    messages: new Array(),
    counter: 0, interval: 0,
    target: null, source: null,
    initialize: function(target, options)
    {
        this.target = $(target);
		this.pausing = false;
		this.target.observe('mouseover',function() {
			this.pausing = true;
		}.bind(this));
		this.target.observe('mouseout',function() {
			this.pausing = false;
		}.bind(this));
        //this.source = $(source);
        this.options = Object.extend({
            updateRate: 1.0,
            duration: 0.5,
            beforeStart:function(){
                this.counter++;
            }.bind(this)
        }, options || {});
        this.start();
    },
    start: function()
    {
			this.moving = false;
			this.interval = new PeriodicalExecuter(function(pe) {
				if ( ( ! this.moving ) && ( ! this.pausing ) ) {
					this.moving = true;
					var children = this.target.childElements();
					this.firstNode = children[0];
					Effect.SlideUp(this.firstNode, {duration: 1.0, afterFinish: function() {
							Effect.SlideDown(this.firstNode,{duration: 0});
							this.firstNode.remove();
							//this.target.style.top = '0px';
							this.target.appendChild(this.firstNode);
							this.moving = false;
							this.start();
						}.bind(this)
					});
					this.stop();
				}
			}.bind(this),3.0);
    },
    stop: function()
    {
        this.interval.stop();
    }
};

