var Ticker = Class.create();
Ticker.prototype = {
     messages: new Array(),
     counter: 0, interval: 0,
     target: null, source: null,
     initialize: function(target, source, options)
     {
         this.target = $(target);
	this.source = $(source);
         this.options = Object.extend({
		updateRate: 2,
		duration: 0.5,
		beforeStart:function(){
			this.counter++;
		}.bind(this)
	}, options || {});

         Element.cleanWhitespace(this.source);
         $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('&nbsp;').appendChild(Builder.node('span',
{style:'opacity:0'}, this.messages[this.counter]));
		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();
     }
};

/*
window.onload=function() {
	ticker = new Ticker('output','list_ul_text'); } */