function getXhr()
{
	var xhr = null; 
	if(window.XMLHttpRequest) // Firefox et autres
	xhr = new XMLHttpRequest(); 
	else if(window.ActiveXObject){ // Internet Explorer 
	try {
	xhr = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	xhr = new ActiveXObject("Microsoft.XMLHTTP");
	}
	}
	else { // XMLHttpRequest non supporté par le navigateur 
	alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	xhr = false; 
	}
	
	return xhr;
}

function reloadCaptcha(div) {
	loadPage(div,'js/captcha.php','',false,'');
}

function loadPage(div,file,send,rload,after)
{
	var xhr = getXhr();
	
	var div = div;
	var file = file;
	
	xhr.open("POST", './'+file, true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send(send);

	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4)
		{
            if (xhr.status == 200)
			{
				if(div!='')
				{
					document.getElementById(div).innerHTML = '';
					document.getElementById(div).innerHTML = xhr.responseText;
				}
				
				if(rload==true){window.location.reload();}
				if(after!=""){eval(after);}
			}
		}
	}
}