function nextContent(firstTime)
{
	var t=this.timeBetweenContent;

  this.currentContent=++this.currentContent % this.content.length;

	if (this.transitionDuration>0)
	{
		if (!firstTime)
		{
			if (this.switcher.filters)
				this.switcher.filters[0].apply();
		}
	}

  this.switcher.innerHTML=this.content[this.currentContent];

	if (this.transitionDuration>0)
	{
		if (!firstTime)
		{
			if (this.switcher.filters)
				this.switcher.filters[0].play(this.transitionDuration/1000);
			t+=this.transitionDuration;
		}
	}

  if (this.content.length>1)
    setTimeout('objects[' + this.id + '].nextContent(false)',t);
}

function startSwitch()
{
  this.nextContent(true);
}

var objectID=0;
var objects=new Array();
function getNextId()
{
  return objectID++;
}

/*
	itDisplayTime: time in milliseconds to display 1 item
	transitionDuration: time in milliseconds between two content items
	set transitionDuration to 0 or leave blank for no transition
	
	Item1[displayed for itDisplayTime]
		---(transition: time=transitionDuration)--->
			Item2[displayed for itDisplayTime]
				---(transition: time=transitionDuration)--->
					Item3[displayed for itDisplayTime]
							...
				---(transition: time=transitionDuration)--->
					ItemN[displayed for itDisplayTime]
						---(transition: time=transitionDuration)--->
							Item1[displayed for itDisplayTime]
*/
function ContentSwitcher(contentid,content,itDisplayTime,transitionDuration)
{
  this.id=getNextId();
  this.content=content;
  this.timeBetweenContent=itDisplayTime;
  this.currentContent=-1;
	if (transitionDuration + '' == 'undefined') transitionDuration=0;
	this.transitionDuration=Math.max(0,transitionDuration);
  this.switcher=document.getElementById(contentid);
	if (this.switcher.filters && this.transitionDuration>0)
	{
		if (this.switcher.style.height=='')
			this.switcher.style.height=1;
		if (this.switcher.style.width=='')
			this.switcher.style.width=1;
		this.switcher.style.filter="blendTrans";
	}
  
  this.nextContent=nextContent;
  this.start=startSwitch;
  
  objects[this.id]=this;
}
