function gotoCreation (creationGoto)
{
  var form = document.getElementById ('phoneform');
  form.elements['goto'].value = creationGoto;
  form.submit ();
  return true;
}

function defaultGoto (defaultGoto)
{
  var form = document.getElementById ('phoneform');
  form.elements['goto'].value = defaultGoto;
  return true;
}

function clic1()
{
  ctl = document.getElementById ('phoneform').elements['tel'];
  var sString = "";
  sString = keepInteger (ctl.value);
  if (sString != ctl.value)
  {
    ctl.value = sString;
  }
}

function validePhone ()
{
  var phone = document.getElementById ('phoneform').elements['tel'].value;
  if (phone != parseFloat (phone) || phone.length != 10)
  {
    return false;
  }
  return gotoCreation ('attente');
}

function validePhoneCPS ()
{
  var phone = document.getElementById ('phoneform').elements['tel'].value;
  if (phone != parseFloat (phone) || phone.length != 10)
  {
    return false;
  }
  return gotoCreation ('choix_options');
}

function keepInteger(pString)
{
  var re = new RegExp("[0-9]");
  var vString = new String(pString);
  var newString = "";
  for (n=0 ; n<vString.length ; n++)
  {
    if (vString.substring(n,n+1).search(re) == 0)
    { // Le caractère testé est un chiffre.
      newString += vString.substring(n,n+1);
    }
  }
  return newString;
}

