// JavaScript Document


function runTestimonials(num){
	// Define testimonial teasers (not the full testimonials those are found on the testimonials page)
	var testimonials = new Array();
	
	testimonials[0] = '"Diligent workers. Questions were answered politely and were professional in dealing with me. Attention to work detail is fantastic. Would hire for a job again. The house looks incredible. Justin and his crew are total master craftsmen! The absolute best!"<span>- Brian &amp; Charla</span>';
	testimonials[1] = '"This project FAR exceeded my expectations. The guys did a fantastic job. I hope to work with you all in the future."<span>- Lisa</span>';
	testimonials[2] = '"I liked the way they were detail oriented. Very nice work and very pleasant guys to by around. I love the way my house looks."<span>- Catherine</span>';
	testimonials[3] = '"Just wanted you to know what a difference we feel in our home this winter with the new siding and windows..."<span>- Lorrie &amp; David</span>';
	testimonials[4] = '"Your installer, Jim did a wonderful, professional job. We were surprised at the minimal disruption and mess in our house..."<span>- Lon</span>';
	testimonials[5] = '"The quality of work is superb and I truly do feel I received what I paid for and more. I have had many nice compliments from neighbors..."<span>- Gary</span>';
	testimonials[6] = '"Our neighbor came over and looked at the windows and asked many questions. They have since had all of their windows replaced by Nu-Vu."<span>- Garry &amp; Sandy</span>';
	
	// If the count has reached the end reset it to zero to start from the begining
	if(num >= testimonials.length)
	{
		num = 0;
	}
	
	// Replace the testimonials
	$("#index_testimonials").
		// Hide the element
		addClass("hidden").
		// Fade the hidden element to 0 opacity for one second (basically pausing)
		fadeTo(1000, 0, function()
							{
								// Show the element (still at 0 opacity)
								$(this).removeClass("hidden");
								// Replace the content with the next testimonial
								$(this).html(testimonials[num]);
							}).
		// Fade the element 100 opacity
		fadeTo("slow", 1).
		// Fade to 100 opacity for 10 seconds (basically pausing)
		fadeTo(10000, 1).
		// Fade to 0 opacity and rerun the function
		fadeTo("slow", 0, runTestimonials(num+1));
}

// When the page is ready run the testimonials
$(document).ready(function(){runTestimonials(0);});
