$(document).ready(function() {
  var imgs = $('div#ill_dte>img');
  var nombre = 0;
  imgs.each(function() {nombre++;}); // il doit bien y avoir autre chose...
  var courant = nombre - 2;
  var duree = 1500;
  var accel = 'easeOutQuint';
  var rep = function() {
    courant++;
    if(courant >= nombre) courant = 0;
    var suivant = (courant == nombre - 1 ? 0 : courant + 1);
    imgs.each(function(index) {
    	switch(index) {
    		case courant: $(this).css({left: 0, width: 160, height: 387}).show(); break;
    		case suivant: $(this).css({left: 160, width: 0, height: 387}).show(); break;
    		default: $(this).hide();
    	}
    });
    imgs.eq(courant).animate({left: 0, width: 0, height: 387}, duree, accel);
    imgs.eq(suivant).animate({left: 0, width: 160, height: 390}, duree, accel);
  };
  imgs.click(rep);
  window.setTimeout(rep,500);
  window.setInterval(rep, 3000);
});

