	var xhr = null; 
	
	// Fonction de creation de l'objet XMLHttpRequest qui resservira pour chaques fonctions AJAX 
	function getXhr() { 
		if(window.XMLHttpRequest) 
			xhr = new XMLHttpRequest(); 
		else if(window.ActiveXObject) { 
			try { 
				xhr = new ActiveXObject("Msxml2.XMLHTTP"); 
			} 
			catch (e) { 
				xhr = new ActiveXObject("Microsoft.XMLHTTP"); 
			} 
		} 
		else { 
			alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest, veuillez le mettre à jour"); 
			xhr = false; 
		} 
	} 
	
	//fonction de menu secondaire pour le parrainage
	function menu( type, code )
	{
		getXhr(); 
		xhr.onreadystatechange = function() { 
			if ( xhr.readyState == 4 && xhr.status == 200 ) 
			{ 
				document.getElementById( 'conteneur' ).innerHTML = xhr.responseText;
			} 
		} 
	
		xhr.open( "POST", 'parrainage_lien.ctl.php', true );
		xhr.setRequestHeader( 'Content-Type','application/x-www-form-urlencoded' ); 
		
		xhr.send( "format=" + type + "&code=" + code); 
	}
	
	
	//Verfie que les champs password et email on bien ete remplis avant d'afficher le captcha
	function verifOk()
	{
		var exma = new RegExp("^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$"); 
		var ok = false;
		if (
				( document.getElementById( 'mail'       ).value.match( exma ) ) 
			&&  ( document.getElementById( 'nom'        ).value.length >= 1 ) 
			&&  ( document.getElementById( 'prenom'     ).value.length >= 1 ) 
			&&  ( document.getElementById( 'code_postal').value.length >= 4 )
			&&  ( document.getElementById( 'ville'      ).value.length >= 1 )
		)
		{
			if (
					( document.getElementById( 'password' ).value == document.getElementById( 'passwordC' ).value) 
				&&  ( document.getElementById( 'password' ).value != "" )
			)
			{
				if (
						( document.getElementById('mail').value == document.getElementById( 'mailC' ).value ) 
					&&  ( document.getElementById('mail').value != "" )
				)
				{
					if (
						 	( document.getElementById( 'mail_commerciaux_oui' ).checked ) 
						||  ( document.getElementById( 'mail_commerciaux_non' ).checked )
					)
					{
						if (
								( document.getElementById( 'day'  ).value != '' ) 
							&&  ( document.getElementById( 'month').value != '' ) 
							&&  ( document.getElementById( 'year' ).value != '' )
						 	&&  ( document.getElementById( 'pays' ).value != '' )
						 	&&  ( document.getElementById( 'civilite' ).value != '' )
						)
						//
						// 
						{
					
							if ( document.getElementById( 'conditionG' ).checked )
							{
								ok = true;
								showBlock('inscri_box-captcha');
							}
						}
					}			
				}
			}
		}
		if (ok == false)
		{
			fermercaptcha();
		}
	}
	
	function verif(data, datac, err, type) { 
		getXhr(); 
		xhr.onreadystatechange = function() { 
			if(xhr.readyState == 4 && xhr.status == 200) { 
				document.getElementById(err).innerHTML = xhr.responseText;
			} 
		} 
	
		xhr.open("POST",'../../fonctions/verifInscription.php',true);
		xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
		
		valData = document.getElementById(data).value; 
		valDataC = document.getElementById(datac).value; 
		verifOk();
		
		xhr.send("data="+valData+"&datac="+valDataC+"&format="+type); 
	}
	
	function verifMail( data, err )
	{
		getXhr(); 
		xhr.onreadystatechange = function() { 
			if ( xhr.readyState == 4 && xhr.status == 200 ) { 
				document.getElementById( err ).innerHTML = xhr.responseText;
			} 
		} 
	
		xhr.open( "POST", '../../fonctions/verifInscription.php', true) ;
		xhr.setRequestHeader( 'Content-Type','application/x-www-form-urlencoded' ); 
		
		valData = document.getElementById( data ).value; 
		
		xhr.send("data="+valData+"&format=mail2"); 
	}
	
	function verifBirth() { 
		getXhr(); 
		xhr.onreadystatechange = function() { 
			if(xhr.readyState == 4 && xhr.status == 200) { 
				//document.getElementById(err).innerHTML = xhr.responseText;
				 if(xhr.responseText == 28)
				 	document.forms[0].day.options[27].selected=true
				 else if(xhr.responseText == 29)
				 	document.forms[0].day.options[28].selected=true
				 else if(xhr.responseText == 30)
				 	document.forms[0].day.options[29].selected=true
			} 
		} 
		xhr.open("POST",'../../fonctions/verifInscription.php',true);
		xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
	
		day = document.getElementById('day').value; 
		month = document.getElementById('month').value; 
		year = document.getElementById('year').value; 
	
		xhr.send("day="+day+"&month="+month+"&year="+year+"&format=date"); 
	}