﻿var index = 1;

$(document).ready(function() {
    $('#slideshow > img:first').css('display', 'block');
    setTimeout(slide, 8000);
});

function slide() {
    var count = 0;
    $('#slideshow > img').each(
        function(idx) {
            $(this).css('display', 'none');
            count++;
        }
    );

    index++;
    if (index > count) {
        index = 1;
    }

    $('#slideshow > img:nth-child(' + index + ')').fadeIn('slow');

    setTimeout(slide, 8000);
}