function add_ref(i) {

     var ref = parseFloat(i) + 1;
     if(ref > 20)
          {
          exit;
     }
     if(document.getElementById('child'+ref).style.display == "none")
          {
          document.getElementById('child'+ref).style.display = 'inline';
          document.getElementById('ajout').innerHTML = '[<a href="javascript:add_ref('+ref+')">Ajouter</a>]';
          document.getElementById('child'+ref).innerHTML += '<br/><span id="labe'+ref+'">#'+ref+'</span><input id="ref'+ref+'" name="ref'+ref+'" type="text" onKeydown="add_ref('+ref+')>';
          }
          
     if(ref < 2) {
          document.getElementById('del').innerHTML = '';
     }
     else {
          document.getElementById('del').innerHTML = '[<a href="javascript:del_ref('+ref+')">Retirer</a>]';
     }

}

function del_ref(i) {
     var ref = parseFloat(i);
     document.getElementById('child'+ref).innerHTML = '';
     document.getElementById('child'+ref).style.display = 'none';
     document.getElementById('ajout').innerHTML = '[<a href="javascript:add_ref('+(ref - 1)+')">Ajouter</a>]';
     
     if(ref <= 2) {
          document.getElementById('del').innerHTML = '';
          }
     else {
          document.getElementById('del').innerHTML = '[<a href="javascript:del_ref('+(ref - 1)+')">Retirer</a>]';
     }
}