function diaporama(par_hover,id,cadence,temp_expo,next){
  var y=0;
  var flag=0;
  var timer;
  var marqueur=0;
  var chemin=document.getElementById(id).getElementsByTagName('li');
  var cadence=cadence;
  var temp_expo=temp_expo;
  if(next){
    photo_change();
    return;
  }
  initialisation();
  function initialisation(){    
    for(i=0;i<chemin.length;i++){
      if(chemin[i].className != "no-diapo"){
        chemin[i].style.opacity=0;
        chemin[i].style.filter="0";
        chemin[i].style.display=('none');
      }
    }
    chemin[0].style.display=('block');
    timer_control();
  }
  
  function timer_control(){
    timer=setTimeout(fadeInNOut,cadence); 
  }
  
  function fadeInNOut(){
    clearTimeout(timer)
    if(y>101+temp_expo){
      flag=1
    }
    if(y<-5){
      flag=0
      y=0;
      chemin[marqueur].style.opacity=0; 
      chemin[marqueur].style.filter="0";
      chemin[marqueur].style.display=('none');
      photo_change()
    }
    if(flag==0){
      y+=1;
    }
    if(flag==1){
      y-=1;
    }
    chemin[marqueur].style.opacity=y/100; 
    chemin[marqueur].style.filter="alpha(opacity="+y+")";
    timer_control()
    }
  
  function photo_change(){
    if(marqueur == chemin.length-1){
      marqueur = 0;
    }else{
      marqueur +=1;
    }
    if(chemin[marqueur].className == 'no-diapo'){
      photo_change();
    }else{
      chemin[marqueur].style.display=('block');
      fadeInNOut()
    }
  }
  if(par_hover!=''){
    if (window.addEventListener) {
      document.getElementById(par_hover).addEventListener('mouseover', stop, true);
    }
    else if (window.attachEvent) {    
      document.getElementById(par_hover).attachEvent('onmouseover', stop);
    }
    if (window.addEventListener) {
      document.getElementById(par_hover).addEventListener('mouseout', depart, true);
    }
    else if (window.attachEvent) {    
      document.getElementById(par_hover).attachEvent('onmouseout', depart);
    }
  }
  if(document.getElementById('next')){
    if (window.addEventListener) {
      document.getElementById('next').addEventListener('click', photo_next, true);
    }
    else if (window.attachEvent) {    
      document.getElementById('next').attachEvent('onclick', photo_next);
    }
  }

  function stop(){
    flag = 2;
    y = 100;
  }
  function depart(){
    flag = 1;
  }
  function photo_next(){
      flag=0
      y=100;
      chemin[marqueur].style.opacity=0; 
      chemin[marqueur].style.filter="0";
      chemin[marqueur].style.display=('none');
      photo_change()
  }
}
 


 
