var theTimeOut;
function toggleDiv(div) {
  var theDiv = document.getElementById(div);
  if (theDiv.style.display == 'none') {
    // afficher
      theDiv.style.height = '1px';
      theDiv.style.overflow = 'hidden'
      theDiv.style.display = 'block';
      theTimeOut = setTimeout( 'expandDiv(\''+div+'\')' ,10);
  } else {
    // Masquer
      theTimeOut = setTimeout( 'collapseDiv(\''+div+'\')' ,10);
  }
}

function expandDiv(div) {
  var theDiv = document.getElementById(div);
  theDiv.style.height = (parseInt(theDiv.style.height) + 20) + 'px';
  if ((theDiv.scrollHeight - parseInt(theDiv.style.height)) > 0) {
     theTimeOut = setTimeout( 'expandDiv(\''+div+'\')' ,10);
  }
}

function collapseDiv(div) {
  var theDiv = document.getElementById(div);
  if ( parseInt(theDiv.style.height) - 5 > 0) {
    theDiv.style.height = (parseInt(theDiv.style.height) - 20) + 'px';
  } else {
    theDiv.style.height = 0;
  }
  if ((theDiv.scrollHeight + parseInt(theDiv.style.height)) > theDiv.scrollHeight) {
     theTimeOut = setTimeout( 'collapseDiv(\''+div+'\')' ,10);
  } else {
      theDiv.style.display = 'none';
  }
}

