  var encours;
  function separeMilliers (sNombre) {
    separateurMilliers = ' ';
    var sRetour = "";
    while (sNombre.length % 3 != 0) {
      sNombre = "0"+sNombre;
    }
    for (i = 0; i < sNombre.length; i += 3) {
      if (i == sNombre.length-1) separateurMilliers = '';
        sRetour += sNombre.substr(i, 3)+separateurMilliers;
      }
    while (sRetour.substr(0, 1) == "0") {
      sRetour = sRetour.substr(1);
    }
    return sRetour.substr(0, sRetour.lastIndexOf(separateurMilliers));
  }

  function incremente()
  {
    encours += Math.round(Math.random()*2)+1;
    if (document.getElementById('nb_msg')) document.getElementById('nb_msg').innerHTML=separeMilliers(encours);
  }


  setInterval("incremente()",500);


  function validate(email_id,error_msg) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.getElementById(email_id).value;
   if(reg.test(address) == false) {
      alert(error_msg);
      return false;
   }
    else return true;
  }
 
  function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
  }
  function ltrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
  }
  function rtrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
  }
