var carrousel_container = null;
var carrousel_items = null;
var current_item = 0;

function show_img() {
  if(!carrousel_items || !carrousel_items[current_item]) {
    return false;
  }
  $(carrousel_items[current_item]).fadeOut("slow");
  if(carrousel_items[current_item + 1]) {
    current_item++;
  }
  else {
    current_item = 0;
  }
  $(carrousel_items[current_item]).fadeIn("slow");
}

function setupCarrousel() {
  carrousel_items = $('#carrousel img');
  current_item = carrousel_items.length - 1; 
  $(carrousel_items).each(function(i) {
    if(i > 0) {
      $(this).css('display', 'none');
    }
  });
}


setInterval(show_img, 6000);
$(document).ready(function () {
    setupCarrousel();
    show_img();
});
