/* Création d'un objet ajax selon le navigateur */
function ajax_new(){
	var ajax = null; 
	if(window.XMLHttpRequest) // Firefox et autres
		ajax = new XMLHttpRequest(); 
	else if(window.ActiveXObject){ // Internet Explorer 
		try {
			ajax = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			ajax = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return ajax
}
			
/* envoie une requete en Ajax (invisible) */
function ajax_send(url){
	var ajax = ajax_new()
	ajax.open("GET",url,true);
	ajax.send(null);
}

/* envoie une requete en Ajax (invisible) et charge la réponse */
function ajax_sendAndLoad(url, div_id){
	div = document.getElementById(div_id);
	var ajax = ajax_new();
	div.innerHTML = '<img src="template/img/ajax-loader.gif" />';
	// On défini ce qu'on va faire quand on aura la réponse
	ajax.onreadystatechange = function(){
		if(ajax.readyState == 4 && ajax.status == 200){
			div.innerHTML = ajax.responseText;
		}
	}
	ajax.open("GET",url,true);
	ajax.send(null);
}