var testimonials	= []; // AJAX fills it with all the previews
var current_tst		= 0;
var timeout 		= 10000; // miliseconds to wait

function init_testimonials(){
	new Ajax.Request('/testimonials.json',
	{
		method:			'get',
		onSuccess: function(transport){
			var response = transport.responseText || '';
			eval('testimonials = ' + response);
			
			setTimeout('show_testimonial(1);', timeout);
		},
		onFailure: function(transport){ alert("Something went wrong:\n" + transport.responseText) }
	});	
}
st
function replace_tst (){
	$('blk_tst').innerHTML = '"' + testimonials[current_tst].quote + '" <span>-' + testimonials[current_tst].person + '<span>';
	Effect.Appear('blk_tst', { duration: 0.5});
}

function show_testimonial(count_tst) {
	current_tst= count_tst;
	
	Effect.Fade('blk_tst', { duration: 0.5});
	setTimeout('replace_tst();', 500);
	
	current_tst= current_tst+ 1;
	
	if(current_tst>= testimonials.size() ){
		current_tst= 0;
	}
	
	setTimeout('show_testimonial(current_tst);', timeout);
}
