var anzahlElemente;
var aktuellesBild = 0;

$(function () {
     $('.playerbtn').click(function() {
         var index = $('.playerbtn').index(this);
         changePlayer(index);return false;
     });
     window.setInterval("playerPlusPlus()",8000);
     anzahlElemente = $(".player_img").size()-1; });

function changePlayer(id){
     $('.player_img').each(function(index) {
         if($(this).css('display') != 'none'){
             $('.playerbtn').eq(index).removeClass('active');
             $(this).fadeOut();
         }
     });
     $('.player_img').eq(id).fadeIn();
     $('.playerbtn').eq(id).addClass('active');

     aktuellesBild = id;
}

function playerPlusPlus(){
     if(aktuellesBild == anzahlElemente)
     changePlayer(0);
     else
     changePlayer(aktuellesBild+1);
}

