slideShow();

var running = false;

function slideShow() {
    $('#gallery li').css({
        opacity: 0.0
    });
    $('#gallery li:first').css({
        opacity: 1.0
    });
    setInterval('gallery()', 7000);
}

function gallery() {
    var current;
    if (running) {
        current = $('#gallery li.show');
    } else {
        current = $('#gallery li:first');
        running = true;
    }
    var next = ((current.next().length) ? current.next() : $('#gallery li:first'));
    next.css({
            opacity: 0.0
        })
        .addClass('show')
        .animate({
            opacity: 1.0
        }, 2000);
    current.animate({
            opacity: 0.0
        }, 2000)
        .removeClass('show');
}

