NewsTicker = new Class({
	Implements: Options,
	options: {
		delay: 5000,
		duration: 1800,
		forceHeigth: null,
		tipMessage: 'Click to read more...'
	},
	
	initialize: function(elID, options)
	{
		this.setOptions(options);
		this._context = $(elID);
		this._currentNews = 0;
		this._scroller = null;
		this._itemIdPrefix = this._context.get('id') + "_" + (new Date()).getTime() + '_';
		this._startPosition = null;
		
		if($defined(this._context))
		{
			var firstChild = this._context.getFirst();
			
			if($defined(firstChild))
			{
				this._context.setStyle('overflow', 'hidden');
				this._context.grab(firstChild.clone());
				
				this._context.getChildren().each(function(item, index, array)
				{
					if($defined(this.options.forceHeigth)) item.setStyle('height', this.options.forceHeigth);
					item.set('id', this._itemIdPrefix + index);

				}.bind(this));
				
				this._reset();
				this._scroller = new Fx.Scroll(this._context, {fps: 30, duration: this.options.duration, wheelStops: false});
				this._showNext.periodical(this.options.delay, this);
			}
		}
		//else throw new Error('[NewsTicker] Missing or invalid element ID: ' + elID);
	},
	
	_reset: function()
	{
		this._currentNews = 0;
		this._context.scrollTo(0, 0);
	},
	
	_showNext: function()
	{
		if(this._currentNews >= this._context.getChildren().length - 1)
		{
			this._reset();
			this._showNext();
		}
		else
		{
			this._currentNews++;
			this._scroller.toElement(this._itemIdPrefix + this._currentNews);
		}
	}
});