	
	var testimonialList;
	window.addEvent('domready', initTestimonials);
	
	function initTestimonials()
	{

		var request = new Request({ method: 'get', url: "/App_Pages/Testimonial_List.aspx", onSuccess: function(response)
		{
			testimonialList = JSON.decode(response).Testimonials;
			if (testimonialList)
			{
				if (testimonialList.length > 0)
				{
					$('testimonial').set({ 'morph': { duration: 750, transition: Fx.Transitions.Quad.EaseInOut }, 'opacity': 0 });
					showInitialTestimonial();
					(function() { showRandomTestimonial() }).periodical(15000);
				}
			}
		}
		}).get();

	}

	function showInitialTestimonial()
	{

		var index = Math.floor(Math.random() * testimonialList.length);
		var testimonial = testimonialList[index];
		$('testimonial').getChildren()[0].innerHTML = testimonial.Testimonial;
		$('testimonial').getChildren()[1].innerHTML = 'Testimonial by ' + testimonial.Source;
		$('testimonial').set({ 'opacity': 1 });

	}
	
	function showRandomTestimonial()
	{

		var index = Math.floor(Math.random() * testimonialList.length);
		var testimonial = testimonialList[index];		
		$('testimonial').morph({'opacity':0});
		(function()
		{
			$('testimonial').getChildren()[0].innerHTML=testimonial.Testimonial; 
			$('testimonial').getChildren()[1].innerHTML='Testimonial by ' + testimonial.Source; 
			$('testimonial').morph({'opacity':1});
		}).delay(750);

	}


