// --------------------------------------------
//		Top Message Container
//		20098-07-03
// --------------------------------------------
TopMessage = Class.create({
	// constructor
	initialize : function () {
		// uint, current text No. +1
		this.currentNo = 0;
		// Timer Object ID
		this.timerID;
		// Array, text lists
		this.messages;
	}
	
	, init : function () {
		var me = this;
		function next () {
			if (me.currentNo == NaN) return;
			me.currentNo++;
			if (me.currentNo > me.messages.length) me.currentNo = 0;
			if (!me.messages[me.currentNo]) return;
			
			var context = me.messages[me.currentNo];
			
			$("tm1").fade({duration:0.5,afterFinish:function(){
													$("tm1").update(context);
													$("tm1").appear({duration:0.5});
												}});
		}
		this.messages = [$("tm1").innerHTML, $("tm2").innerHTML, $("tm3").innerHTML, $("tm4").innerHTML];
		if (!this.timerID) this.timerID = setInterval(next, 5.5 * 1000);
	}
});

document.observe("dom:loaded", function () {
		var topm = new TopMessage();
		topm.init();
	});