<form style="position:relative; left:25px; width: 120px;display:none" id=frm1>

<p align=center>  Login</p>
<p align=center> <input type=text id=txtmail name=txtmail value="" size="15" /></p>
 <p align=center>  Password</p>
 <p align=center><input type=password id=txtmdp name=txtmdp value="" size="15" /></p>
 <p align=center><input type=button id=cmdsubmit value="Connexion" onclick=Connexion() size="20" /></p>
 <p align=center><a style="color:#FFF" href="nouveaucompte.php" target="_blank"><u>Cr&eacute;er un 
compte</u></a></p>
 <p align=center><a style="color:#FFF" href="oublimdp.php" target="_blank"><u>Mot de passe 
oubli&eacute;</u></a></p>
</form>
<form style="position:absolute; left: 25px; width: 120px; display:none" method="post" 
id=frm2>
<input type=hidden id=temsession value="" 
size="20" />
<p align=center>  Bienvenue</p>
<p align=center><span id=nomprenom></span>
  <span></span></p>
<a style="color:#FFF" href="initsession.php"><u>Se d&eacute;connecter</u></a>
</form>

<script src="oXHR.js" type=text/javascript></script>
<script type="text/javascript">

function Connexion()
{

Verif_Login();


}

function Verif_Login()
{
var xhr = getXMLHttpRequest();
var Rep="";
	


				
xhr.onreadystatechange  = function()
    { 
		
		
         if(xhr.readyState  == 4)
         {
			//document.getElementById("temsession").value="ok";
			
			
			
			
              if(xhr.status  == 200) 
                 {//document.ajax.dyn="Received:"  + xhr.responseText; 
				 
				 Rep= xhr.responseText;
				
				//alert(xhr.responseText);
				
				//si la vérif n'a pas échouée
					if (Rep!="echec")
					{
					
					document.getElementById("nomprenom").innerHTML=Rep;
					
					var a = document.getElementById("frm1");
					var i = document.getElementById("frm2");

					a.style.display = "none";
					i.style.display = "block";
					
					
					
					}else
					{
						//si le login était renseigné
						if (document.getElementById("txtmail").value!="")
						{alert("L'authentification a échouée");
						}
					}
                 //document.ajax.dyn="Error code " + xhr.status;
				 }
         }
    }; 

	var linkverif="";
	linkverif="verifLogin.php?mail=" + document.getElementById("txtmail").value + "&mdp=" + document.getElementById("txtmdp").value;
	
	//alert(linkverif);
//appel de la procédure de vérification du compte
xhr.open("GET", linkverif,true);


//alert(xhr.responseText);

xhr.send(null);
	
	
}


window.onload = function()
    {
		
		var a = document.getElementById("frm1");
		var i = document.getElementById("frm2");

		a.style.display = "block";
		i.style.display = "none";
		
		//on essai de se logger
		Verif_Login();
		


	}
</script>