Event.observe(window, 'load', function() { 
	//Move testimonials in to right col	
	new Ajax.Request('/testimonials/output/product_testimonials.php',
	{
		method:'get',
		onSuccess: function(transport){
			$('testimonialContainer').hide();
			$('testimonialContainer').update(transport.responseText);
			primeProdTestimonial();
		},
		onFailure: function(){ alert('Something went wrong...') }
	});
});

var testimonialPos = 0;
var testimonials = 0;

var testNext = new Image();
var testBack = new Image();
var testNextOver = new Image();
var testBackOver = new Image();

testNext.src = '/images/testimonialButtonRightF_02.png';
testNextOver.src = '/images/testimonialButtonRightOverF_01.png';
testBack.src = '/images/testimonialButtonLeftF_01.png';
testBackOver.src = '/images/testimonialButtonLeftOverF_01.png';

function primeProdTestimonial() {
	var testimonialContainer = document.getElementById('testimonialContainer');
	testimonials = testimonialContainer.getElementsByTagName('div');
	
	document.getElementById('rightColTestiContent').innerHTML = testimonials[testimonialPos].innerHTML;

	setTimeout('prodTestimonialAuto()',30000);
}

function prodTestimonialAuto() {
	document.getElementById('testimonialButtonRight').src = testNextOver.src
	prodTestimonialNext();
	document.getElementById('testimonialButtonRight').src = testNext.src
	setTimeout('prodTestimonialAuto()',30000);
}

function prodTestimonialBack() {
	testimonialPos = testimonialPos - 1;
	if(testimonialPos <= 0) { testimonialPos = (testimonials.length - 1); }
		
	document.getElementById('rightColTestiContent').innerHTML = testimonials[testimonialPos].innerHTML;
}

function prodTestimonialNext() {
	testimonialPos++;	
	if(testimonialPos >= testimonials.length) { testimonialPos = 0; } 
	
	document.getElementById('rightColTestiContent').innerHTML = testimonials[testimonialPos].innerHTML;
}

function prodTestimonialNextOver(theElement) {
	theElement.style.cursor = "pointer";
	theElement.src=testNextOver.src
}

function prodTestimonialNextOut(theElement) {
	theElement.style.cursor= "default";
	theElement.src=testNext.src
}

function prodTestimonialBackOver(theElement) {
	theElement.style.cursor = "pointer";
	theElement.src=testBackOver.src
}

function prodTestimonialBackOut(theElement) {
	theElement.style.cursor= "default";
	theElement.src=testBack.src
}