function TwitterTicker( sWrapper )
{
	window.twitterticker = this;
	if( this.wrapper = document.getElementById(sWrapper) )
	{
		this.interval	= null;
		this.currentid	= 0;
		this.opacity	= 0;
		this.items		= this.wrapper.getElementsByTagName("div");
		if( this.items.length > 0 )
			this.interval = setTimeout("window.twitterticker.start()", 8000);
	}
	else 
		return false;
};

TwitterTicker.prototype.start = function()
{
	this.opacity = 1;
	this.interval = setInterval("window.twitterticker.fadeout()", 100);
}

TwitterTicker.prototype.fadeout = function()
{		
	this.opacity = Math.round(this.opacity*10)/10 - 0.1;
	if( this.opacity >= 0 ) 
	{
		this.items[this.currentid].style.opacity = this.opacity;
		this.items[this.currentid].style.filter = 'alpha(opacity=' + this.opacity*100 + ')';
	}
	else
	{
		clearInterval(this.interval);
		this.tick();
	}
}

TwitterTicker.prototype.fadein = function()
{
	this.opacity = Math.round(this.opacity*10)/10 + 0.1;
	if( this.opacity <= 1 ) 
	{
		this.items[this.currentid].style.opacity = this.opacity;
		this.items[this.currentid].style.filter = 'alpha(opacity=' + this.opacity*100 + ')';
	}
	else
	{
		clearInterval(this.interval);
		setTimeout("window.twitterticker.start()",8000);
	}
}

TwitterTicker.prototype.tick = function()
{
	this.items[this.currentid].style.display = 'none';

	this.currentid	= this.currentid+1 < this.items.length ? this.currentid+1 : 0;
	this.opacity = 0;
	this.items[this.currentid].style.display = 'block';

	this.interval = setInterval("window.twitterticker.fadein()", 100);
}
