var switchableContent = {
	'area0':{
		'ids':['sidebanner','sidebanner2','sidebanner3'],
		'current':0
	}
};
var ContentSwitcher = function()
{
	var ref = this;

	this._content = new Object();

	this.setContent = function(content)
	{
		this._content = content;
	}

	this.updateContent = function()
	{
		for(area in this._content)
		{
			var index_old = this._content[area].current;
			var index_new;
			if(this._content[area].ids[index_old + 1])
			{
				index_new = index_old + 1;
			}
			else
			{
				index_new = 0;
			}
			this._content[area].current = index_new;
			opacity(this._content[area].ids[index_old], 100, 0, 750);
			opacity(this._content[area].ids[index_new], 0, 100, 750);
			setTimeout(function(){ref.updateContent();},5000);
		}
	}
}

function opacity(id, opacStart, opacEnd, millisec)
{
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;
	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd)
	{
		for(i = opacStart; i >= opacEnd; i--)
		{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
	else if(opacStart < opacEnd)
	{
		for(i = opacStart; i <= opacEnd; i++)
		{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}
function changeOpac(opacity, id)
{
	var object = document.getElementById(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}
