/*************************************************

Rotates the testimonials on the homepage.

Copyright Imorial

*************************************************/

count = 1;
totalCount = 0;
duration = 10; 

function changeTestimonial()
{
	$('TestimonialDisplay').innerHTML	= $('Testimonial' + count).innerHTML;
	
	if (count < totalCount)
		count = count + 1;
	else
		count = 1;
	
	Effect.Appear('TestimonialDisplay');
}

function switchTestimonial() 
{
	Effect.Fade('TestimonialDisplay');
	
	setTimeout('changeTestimonial()',1000);
	setTimeout('switchTestimonial()', duration * 1000);
}

Event.observe(window, 'load', function() {
	if ($('TestimonialDisplay'))
	{
		totalCount = parseInt($('TestimonalCount').value);
		if (totalCount != 0) {

			$('TestimonialDisplay').setOpacity(0);
			changeTestimonial();
			setTimeout('switchTestimonial()', duration * 1000);
		}

	}
});