var delay_between_testimonials = 8000;
var testimonial_count;
$(function() {
	var doc = this;
	$("a.thumb").mouseover(function() {
		var self = this;
		$("#mainimage").attr('src', $(self).find('img').attr('rel'));
	}).click(function() {
		var self = this;
		update_dimensions();
		tb_show(null, $(self).attr('href')+"?width="+thickWidth+"&height="+thickHeight, null);
		return false;
	});
	
	testimonial_count = $("#testimonial_count").html();
});

window.onload = function() {
	setTimeout(function() {
		next_testimonial(1);
	}, delay_between_testimonials);
	
}

function tb_callback() {
	attach_product_view_actions();
	attach_site_actions();
}

function next_testimonial(current) {
	var target = current++ % testimonial_count;
	$("#testimonial_snippet").hide().html($("#testimonial_"+target).html()).fadeIn(500, function() {
		setTimeout(function() {next_testimonial(current);}, delay_between_testimonials);
	});
}