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) }
	});	
}
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);

}
function testSIFR(){
var goudy = {
 src: '/flash/goudy.swf'
};
sIFR.registerEvents = false;
sIFR.useStyleCheck = true;
sIFR.activate(goudy);

sIFR.replace(goudy, {
selector: '#motto'
	,css: [
	  '.sIFR-root { font-size:28px; color:#00457C;}',
	  'label {color:#D6112D; display:inline;}',
	],
	offsetTop:0,
	offsetLeft:0,
    wmode: 'transparent'
});

sIFR.replace(goudy, {
selector: '#desc'
	,css: [
	  '.sIFR-root { font-size:20px; color:#00457C;}',
	  'label {color:#D6112D; display:inline;}',
	],
	offsetTop:0,
	offsetLeft:0,
    wmode: 'transparent'
});

sIFR.replace(goudy, {
selector: '#blk_tst'
	,css: [
	  '.sIFR-root { font-size:23px;; color:#00457C;}',
	  'label {color:#D6112D; display:inline;}',
	],
	offsetTop:0,
	offsetLeft:0,
    wmode: 'transparent'
});
sIFR.initialize();
}
