
var xhr = null;

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 &agrave; jour'); 
	xhr = false; 
	} 
}


function sendAjax(data)
{
	xhr = null;
	getXhr();
	xhr.open("POST", "common/php/enginx.php", true);
	
	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4)
		{
			eval(xhr.responseText);
		}
	}
	
	xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr.send(data);
}

function behavior(idComp,param)
{
	
	if(idComp == "checkLogin" || idComp == "checkMail")
	{
		var data = "action="+idComp+"&param="+param;
		sendAjax(data);
	}
	
}

