window.onload=function(){
	a = setTimeout("RefreshCaptcha(6, 18, 17, 120, 30)", 1);
}

function RefreshCaptcha(NbreCaracs, TextSize, Spacing, Width, Height) {
	var xhr_object = null;
	
	if(window.XMLHttpRequest) // Firefox
		xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
		return;
	}
	
	xhr_object.open("POST", "libs/captcha/captcha.php", true);
	
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4) {
			if(document.getElementById('captcha')) {
				document.getElementById('captcha').src = xhr_object.responseText;
			}
		}
	}
	
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
	var data = "nbrecaracs="+NbreCaracs+"&textsize="+TextSize+"&spacing="+Spacing+"&width="+Width+"&height="+Height;
	xhr_object.send(data);
}
