//Edit fade (transition) speed in miliseconds
var speedFade = 4000;

//Edit initial delay times for each rotating slot in miliseconds
var leftDelay = 4000;
var midDelay = 8000;
var rightDelay = 6000;

//Edit duration of each rotating slot in milisecionds
var leftDuration = 10000;
var midDuration = 10000;
var rightDuration = 10000;


function rotateImgLeft(currentL) {
	numL = jQuery('.slot_left').children().size();
	nextL = 0;
	
	if(!currentL || currentL > numL) { currentL = 1; }
	if( currentL == numL ) { nextL = 1; }
	else { nextL = currentL + 1; }
	
	jQuery('.slot_left img:nth-child('+currentL+')').fadeOut(speedFade);
	jQuery('.slot_left img:nth-child('+nextL+')').fadeIn(speedFade);
	
	jQuery(this).delay(leftDuration, function() {
		rotateImgLeft(currentL + 1);
	});
}
function rotateImgMid(currentM) {
	numM = jQuery('.slot_mid').children().size();
	nextM = 0;
	
	if(!currentM || currentM > numM) { currentM = 1; }
	if( currentM == numM ) { nextM = 1; }
	else { nextM = currentM + 1; }
	
	jQuery('.slot_mid img:nth-child('+currentM+')').fadeOut(speedFade);
	jQuery('.slot_mid img:nth-child('+nextM+')').fadeIn(speedFade);
	
	jQuery(this).delay(midDuration, function() {
		rotateImgMid(currentM + 1);
	});
}
function rotateImgRight(currentR) {
	numR = jQuery('.slot_right').children().size();
	nextR = 0;
	
	if(!currentR || currentR > numR) { currentR = 1; }
	if( currentR == numR ) { nextR = 1; }
	else { nextR = currentR + 1; }
	
	jQuery('.slot_right img:nth-child('+currentR+')').fadeOut(speedFade);
	jQuery('.slot_right img:nth-child('+nextR+')').fadeIn(speedFade);
	
	jQuery(this).delay(rightDuration, function() {
		rotateImgRight(currentR + 1);
	});
}

//Begin image rotating
function runRotate() {
	jQuery(this).delay(leftDelay, function() {
		rotateImgLeft();
	});
	jQuery(this).delay(midDelay, function() {
		rotateImgMid();
	});
	jQuery(this).delay(rightDelay, function() {
		rotateImgRight();
	});
}

jQuery(document).ready(runRotate);
