var mTestimonialIndex = 0;

function showTestimonial(){
	var fadeDelayMs = 600;
	var timeoutDelayMs = 9000;
	var trimAtChar = 150;
	
	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 p#text").hide();
	$("#testimonialTicker p#by").hide();
	$("#testimonialTicker p#text").text('"' + quote + '"');
	$("#testimonialTicker p#text").fadeIn(fadeDelayMs);
	$("#testimonialTicker p#by").text(testimonialBy[mTestimonialIndex]);
	$("#testimonialTicker p#by").fadeIn(fadeDelayMs);	
	
	mTestimonialIndex++;	
	setTimeout("showTestimonial()", timeoutDelayMs);
}

function showTestimonial2(){
	var fadeDelayMs = 600;
	var timeoutDelayMs = 7000;
	var trimAtChar = 150;
	
	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;", "");

	$("#testimonialTicker2 p#text2").hide();
	$("#testimonialTicker2 p#by2").hide();
	$("#testimonialTicker2 p#text2").text('"' + quote + '"');
	$("#testimonialTicker2 p#text2").fadeIn(fadeDelayMs);
	$("#testimonialTicker2 p#by2").text(testimonialBy[mTestimonialIndex]);
	$("#testimonialTicker2 p#by2").fadeIn(fadeDelayMs);	
	
	mTestimonialIndex++;	
	setTimeout("showTestimonial2()", timeoutDelayMs);
}
