tid=0;

$(document).ready(function(){
  tid=setInterval( "slideSwitch(0)", 5000 ); // erstmal die Slideshow starten
});


function slideSwitch(i) {
  var speed=1500;
  var $active = $('#slideshow DIV.active');
  if ( $active.length == 0 ) $active = $('#slideshow DIV.entry:last');

  if (i==0) {
    var $next =  $active.next().length ? $active.next() : $('#slideshow DIV.entry:first');
  } else {
    clearInterval(tid);
    $("#slideshow div:animated").stop();
    var $next =  $('#slideshow #sl'+i);
    speed=100;
    tid=setInterval( "slideSwitch(0)", 8000 ); // erstmal die Slideshow starten
  }

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

  nr=$next.index()+1;

  $('#slideshowOverlay div').removeClass("active");
  $('#slideshowOverlay #st'+nr).addClass("active");
  $next.css({opacity: 0.0}).addClass('active').animate({opacity: 1.0}, speed, function() {
    $active.removeClass('active last-active');
  });
}