
$(document).ready(function () {
    // get the set of testimonials available
	
	$.getJSON("/model/remote/RemoteTestimonialService.cfc?method=getLogoPaths&returnformat=json", handleResponse);
});

handleResponse = function(data){
	testimonials = data;
	index = Math.floor(Math.random()*testimonials.length);
	$("#logoBody img").attr( "src", "/images/logoSets/" + testimonials[index] );
	$("#logoBody img").css( "display", "block" );
}

goToTestimonial = function(newIndex){
	index = newIndex;
	$("#logoBody img").attr( "src", "/images/logoSets/" + testimonials[index] );
}

getIndex = function(increment){
	var newIndex;
	
	if(index+increment < 0){
		newIndex = index+increment+testimonials.length;
	} else {
		newIndex = (index+increment) % testimonials.length;
	}
	
	return newIndex;
}

