var time = 6; // seconds between transitions
var testimonials = [];
var curIndex = 0;
var timer = null;
$(function() {
	// load testimonial data
	$.get('data/testimonials.html',null,function(data) {
		$(data).find("li").each(function() {
			testimonials.push($(this));
		});
		doTimer();
	});
	$("#testimonials").hover(function() {
			clearTimeout(timer);
		}, function() {
			timer = setTimeout(showTestimonial,time*1000);
		}
	);
});
function showTestimonial() {
	$("#testimonials div").fadeOut('fast',doTimer);
}
function doTimer() {
	$("#testimonials div")
		.html(testimonials[curIndex++].html())
		.fadeIn('fast');
	if(curIndex>=testimonials.length) curIndex = 0;
	timer = setTimeout(showTestimonial,time*1000);
}