var tvTips = Class.create();
Object.extend(
	tvTips.prototype, {
		initialize: function(obj) {
			this._obj = obj;
			this._items = this._obj.getElementsByClassName('tipteaseritem');		
			this._currentItem = 0;
			this._totalItems = this._items.length;
		}, 
		showNext: function() {
			var el = this._items[this._currentItem];			
			if (this._currentItem < this._totalItems-1) {
				this._currentItem++;
			} else {
				this._currentItem = 0;
			}
			var el2 = this._items[this._currentItem];
			
			new Effect.Opacity(el, {queue: 'end', from: 1.0, to: 0.0, afterFinish: function() { 
				el.hide(); 
				new Effect.Opacity(el2, {queue: 'end', from: 0.0, to: 1.0, beforeStart: function() { el2.setOpacity(0); el2.show(); } } );
			} } );
		}
	}
);
var mt;
Event.observe(window, 'load', function() { mt = new  tvTips($('tipteaser')); window.setTimeout("next()", 5000); } );

function next() {
	mt.showNext();
	window.setTimeout("next()", 5000);	

}