var current_testimonial = 0;
var current_bucket = 1;
var frequency = 5000;  // the time (in miliseconds) each bucket will change
var testimonials = new Array(
	{
		customer: "Ivan Somyk",
		position: "President,",
		company: "CWI",
		quote: "We are very pleased with your services and we would recommend them to anyone.  Your company is a responsible, environmentally conscious e-steward.  We trust you to properly dismantle and recycle thousands of pounds of electronic e-waste every year."				
	},
	{
		customer: "John F. Denison, DDS",
		position: "",
		company: "The Refuge Medical Clinic",
		quote: "After touring your facility and spending time with your team, I am truly impressed with how great a business you have built...The last group of computers you donated will go to a learning lab that helps high school students keep pace with their graduating class.  With your generous support, dozens of kids will be graduating with their fellow classmates!"				
	},
	{
		customer: "Joel Vedder",
		position: "VP Client and Corporate Services,",
		company: "Digital Controls Corporation",
		quote: "We value our relationship with GES and have found the team to always be professional, dedicated and extremely knowledgeable about the industry.  They help me enhance my managed print services solutions by delivering the totally world class level equipment recycling and data destruction solution that we demand."
	}
);

jQuery(document).ready(function(){
	
	//fill the two buckets right away
	makeQuote();
	makeQuote();
	
	//set the interval to change one bucket at a time every x seconds
	setInterval("makeQuote()", frequency);
	
});

function makeQuote(){
	
	var bucket = $("#bucket_"+current_bucket);
	var t = testimonials[current_testimonial];
	
	
	/*
	create the quote:  Sample mark-up:
	<blockquote>
	<p>"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus neque nisi, luctus vel vehicula ut, vulputate ut ipsum. Integer in sapien in risus vestibulum volutpat luctus sit amet sapien"</p>
	</blockquote>
	<cite>&mdash; <strong>John Smith</strong><br />Managing Principal, OXO</cite>	
	*/
	
	var full_quote = "<blockquote><p>" + t.quote + "</p></blockquote><cite>&mdash; <strong>" + t.customer + "</strong><br />" + t.position + " " + t.company + "</cite>";
	
	bucket.fadeOut("slow", function(){
		bucket.html(full_quote);
		bucket.fadeIn("slow");
	});
	
	//update the value for current_testimonial and current_bucket values
	current_testimonial = (current_testimonial == testimonials.length-1) ? 0 : current_testimonial+1;
	current_bucket = (current_bucket == 1) ? 2 : 1;
}