var Ticker = Class.create();
Ticker.prototype = {
    messages: new Array(),
    counter: 1, interval: 0,
    target: null, source: null,
    initialize: function(target, source, options) 
    {
        this.target = $(target); 
		this.source = $(source);
        this.options = Object.extend({
		updateRate: 4, 
		duration: 1.0,
		beforeStart:function(){ 
			this.counter++;
		}.bind(this) 
	}, options || {});

        Element.cleanWhitespace(this.source);	// Loescht das erste 
        $A($(this.source).childNodes).each(function(sel) {
           this.messages.push(sel.innerHTML.strip());
        }.bind(this));  

	this.start();
    },
    start: function()
    {
	this.interval = new PeriodicalExecuter(function() {
		//this.target.update('').appendChild(Builder.node('div', this.messages[this.counter])); 
		this.target.update('<div>'+this.messages[this.counter]+'</div>');
		new Effect.Appear(this.target.lastChild, this.options);
		if(this.counter == this.messages.length){ this.counter = 0;}
	}.bind(this), this.options.updateRate);
    },
    stop: function()
    {
	this.interval.stop();
    }
};