var mTestimonialIndex = 0;

function showTestimonial(){
	var fadeDelayMs = 600;
	var timeoutDelayMs = 9000;
	var trimAtChar = 100;
	
	if(mTestimonialIndex == testimonialText.length){
		mTestimonialIndex = 0;
	}
	var quote = testimonialText[mTestimonialIndex];
	var endIndex = quote.indexOf(" ", trimAtChar);
	if(endIndex == -1){	
		quote = quote.substr(0, trimAtChar);
	}else{
		quote = quote.substr(0, endIndex) + "...";
	}
	quote = quote.replace("&ldquo;", "");

	$("#testimonialTicker #text").hide();
	$("#testimonialTicker #by").hide();
	$("#testimonialTicker #text").text(quote);
	$("#testimonialTicker #text").fadeIn(fadeDelayMs);
	$("#testimonialTicker #by").html(testimonialBy[mTestimonialIndex]);
	$("#testimonialTicker #by").fadeIn(fadeDelayMs);	
	
	mTestimonialIndex++;	
	setTimeout("showTestimonial()", timeoutDelayMs);
}

