$(document).ready(function(){
	$('#image-rotation img:not(":first")').hide();
    var count=0;
    var countImages = $('#image-rotation img').size();

    if(countImages>1){
        setInterval(nextImage,5000); //The number here dictates the length of time between the animation
    }

    function nextImage() {
        $('#image-rotation img:eq('+count+')').fadeOut(1500); //Length of FadeOut transition
        if(count<countImages-1){
            count++;
        } else {
           	count=0;
        }
       $('#image-rotation img:eq('+count+')').fadeIn(1500); //Length of FadeIn transition
    }	
	
	//Below Variables are numbered with 2 to differ fbetween the top and bottom image transitions
	
	$('#mini-image-rotation img:not(":first")').hide();
    var count2=0;
    var countImages2 = $('#mini-image-rotation img').size();

    if(countImages2>1){
        setInterval(nextImage2,5000); //The number here dictates the length of time between the animation
    }

    function nextImage2() {
        $('#mini-image-rotation img:eq('+count2+')').fadeOut(1500); //Length of FadeOut transition
        if(count2<countImages2-1){
            count2++;
        } else {
           	count2=0;
        }
       $('#mini-image-rotation img:eq('+count2+')').fadeIn(1500); //Length of FadeIn transition
    }
});
