var slidesNum = 2;
var slidesDelay = 5; // seconds

var currentSlide = 1;
var oL, oH, oW;
var slide = function() {
	currentSlide++;
	if (currentSlide > slidesNum) currentSlide = 1;
	$.ajax({
		url: './slides/' + currentSlide + '.txt',
		success: function(data) {
			$('.testimonial > div:first-child').animate(
				{'left': oL},
				'slow',
				function() {
					$('.testimonial > div:first-child').html(data);
					$('.testimonial > div:first-child').animate(
						{'left': oL},
						'slow',
						function() {
							setTimeout(slide, slidesDelay*1000);
						}
					);
				}
			);
		}
	});	
}

$(document).ready(function() {
	oH = $('.testimonial > div').get(0).offsetHeight;
	oW = $('.testimonial > div').get(0).offsetWidth;
	oL = $('.testimonial > div').get(0).offsetLeft;
	$('<div style="height:' + oH + 'px;width:1px"></div>').appendTo('.testimonial');
	$('.testimonial > div:first-child').css('position', 'absolute');
	$('.testimonial > div:first-child').css('width', oW);
	setTimeout(slide, slidesDelay*1000);
});