function slideSwitch() {
    var $active = $('.slideshow img.active-slide');

    if ( $active.length == 0 ) $active = $('.slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('.slideshow IMG:first');

    $active.addClass('last-active-slide');

    $next.css({opacity: 0.0})
        .addClass('active-slide')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active-slide last-active-slide');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});
