function slideSwitch() {
    var $active = $("div.slideshow img.active");
    if ($active.length == 0) {
        $active = $("div.slideshow img:last");
    }
    $active.addClass('last-active');

    var $next =  $active.next().length ? $active.next() : $("div.slideshow img:first");
    $next.css({opacity: 0.0})
        .addClass("active")
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass("active last-active");
        });
}

