var mitlauf=0;

function slideSwitch() {
    var active = jQuery('#slideshow img.active');
    var next = active.next(); 
    
    mitlauf++;
    var total = jQuery('#slideshow img').length;
   
    if (mitlauf == total) { next = jQuery('#slideshow img:first'); mitlauf=0; } 
    
    active.addClass('last-active');

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

jQuery(function() {
    setInterval( "slideSwitch()", 3500 );
});

