<!--

 

var fadeInterval = 150; // Milliseconds.
var fadeRate = 15; // Percent the opacity changes per interval.

var showInterval = 7000; // Time in milliseconds that the text is opaque. 

/* 
Programming Note: Using setInterval can be problematic with Flash on the page in IE.
The events are queued up while Flash is running and will suddenly dequeue without the desired interval after the Flash finishes. This is either Flash hogging the thread or IE using a bad threading model. 

Hence, setTimeout was used, since it will not queue events. Worst case is that
the fading will be delayed.
*/
function nextTestimonial()
{
	testimonialIndex++;
	
	if(testimonialIndex >= arrayContent.length)
	{
		testimonialIndex = 0;
	}

	document.getElementById("testimonialArea").innerHTML = arrayContent[testimonialIndex];
		
	opacity = 0;
	updateOpacity();
	window.setTimeout("fadein()", fadeInterval);
}

function fadein()
{
	opacity += fadeRate;
	
	if(opacity >= 100)
	{
		opacity = 100;
		updateOpacity();
		window.setTimeout("showDone()", showInterval);
	}
	else
	{
		updateOpacity();
		window.setTimeout("fadein()", fadeInterval);
	}
}

function showDone()
{
	window.setTimeout("fadeout()", fadeInterval);
}

function fadeout()
{
	opacity -= fadeRate;
	
	if(opacity <= 0)
	{
		opacity = 0;
		nextTestimonial();
	}
	else
	{
		updateOpacity();
		window.setTimeout("fadeout()", fadeInterval);
	}
}

function randOrd(){
	return (Math.round(Math.random())-0.5); 
} 

function updateOpacity()
{
	document.getElementById("testimonialArea").style.opacity = opacity / 100.00; // This is .00 to make sure a float is generated, not an int (always 0 or 1)!
	document.getElementById("testimonialArea").style.filter = "alpha(opacity=" + opacity + ")";
}


//-->