// JavaScript Document
function Verifier_Numero_Telephone(num_tel)
{
    // Definition du motif a matcher
    var regex = new RegExp(/^(01|02|03|04|05|06|08)[0-9]{8}/gi);
    
    // Definition de la variable booleene match
    var match = false;
    
    // Test sur le motif
    if(regex.test(num_tel))
    {
        match = true;
    }
      else
    {
        match = false;
    }
    
    // On renvoie match
    return match;
}

function sendData(data, page, method, destination) 
{ 
    if(document.all) 
    { 
        //Internet Explorer 
        var XhrObj = new ActiveXObject("Microsoft.XMLHTTP") ; 
    }//fin if 
    else 
    { 
        //Mozilla 
        var XhrObj = new XMLHttpRequest(); 
    }//fin else 
     
    //définition de l'endroit d'affichage: 
    /*var content = document.getElementById(destination); */
     
    //si on envoie par la méthode GET: 
    if(method == "GET") 
    { 
        if(data == 'null') 
        { 
            //Ouverture du fichier sélectionné: 
            XhrObj.open("GET", page); 
        }//fin if 
        else 
        { 
            //Ouverture du fichier en methode GET 
            XhrObj.open("GET", page+"?"+data); 
        }//fin else 
    }//fin if 
    else if(method == "POST") 
    { 
        //Ouverture du fichier en methode POST 
        XhrObj.open("POST", page); 
    }//fin elseif 

    //Ok pour la page cible 
   /* XhrObj.onreadystatechange = function() 
    { 
        if (XhrObj.readyState == 4 && XhrObj.status == 200)
        {
            content.innerHTML = XhrObj.responseText ;
        }
    } */    

    if(method == "GET") 
    { 
        XhrObj.send(null); 
    }//fin if 
    else if(method == "POST") 
    { 
        XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
        XhrObj.send(data); 
    }//fin elseif 
    
}//fin fonction SendData 

function rappell_immediat()
{

    if (document.call.numero.value=='Votre numéro ici')
    {
        alert('Votre numéro n\'est pas valide');
        document.call.numero.value='Votre numéro ici';      
    }
    else
        
        {sendData ('numero=' + document.call.numero.value , 'rappel.php', 'GET', '');   
         alert('Votre numéro de téléphone vient de nous parvenir, un conseiller va prendre contact avec vous immédiatement.');
        
         document.call.numero.value = '';
        // document.form_telephone.e.value = '';
        }
}

