$(document).ready(function() {
	rotatePics(1);					   
});

function rotatePics(currentPhoto) {
	

	var numberOfPhotos = $('.riseslide').length;
	currentPhoto = currentPhoto % numberOfPhotos;
	
	// the number value in this line sets the speed of the photo transitions
	$('.riseslide').eq(currentPhoto).fadeOut(3000, function() {
																	
		// These values must be set here to make IE 8 behave!
		
		$('.testimonialBox').css('filter', 'alpha(opacity=60)');
		
		$('.testimonialText').css('filter', 'alpha(opacity=100)');
		
		// The first value sets the delay before the testimonial appears, the second sets the speed of the transition

		$('.testimonialBox, .testimonialText').delay(4000).fadeIn(1300);
		
		// The first value sets the length of time the testimonial appears, the second value sets the speed of the transition
				
		$('.testimonialBox, .testimonialText').delay(9000).fadeOut(1300);
																	  
		// re-order the z-index
		$('.riseslide').each(function(i) {
			$(this).css(
				'zIndex', ((numberOfPhotos - i) + currentPhoto) % numberOfPhotos
			);
		});
		
		$(this).show();
		
		// The value sets the length of time a photo will appear
		
		setTimeout(function() {rotatePics(++currentPhoto);}, 17000);
				
			
		
	});
	
}
