$(function() {

  $(".carrousel table").each(function(){

    
    var element = $(this);
    var nbElement = element.children("tbody").children('tr').children('td').length;
    var aleatoire = 2000;
    var enCours = 1;
    var deplacement = $(".carrousel").width();
    element.width((deplacement*nbElement)+"px");
    element.children("tbody").children('tr').children('td').width(deplacement+"px");

    element.everyTime(aleatoire , function(i) {

      enCours++;

      var gauche = - deplacement * ( enCours - 1 );

      element.animate({
        left:gauche+"px"
        }, 400, function() {

          // Animation complete
          if(enCours==nbElement){
            element.css("left" , "0px");
            enCours = 1;
          }

        }

      );


    });

  });

});
