function init_ajax(){
	if (window.XMLHttpRequest){		
		return new XMLHttpRequest();     // Firefox, Safari, ...
	}
	else if (window.ActiveXObject){
		return new ActiveXObject('Microsoft.XMLHTTP');    // Internet Explorer 
	}
	else{
		return false;
	}
}

function get_ajax(p,xhr){	
	xhr.open("GET",p,true);
	xhr.send(null);
}

function get_afc(id1, id2, id3) {			
	var xhr = init_ajax();	
	var url = 'pages/ajax_affiche_construction.php?c=' + id1 + '&x=' + id2 + '&y=' + id3;										
	get_ajax(url,xhr);
	xhr.onreadystatechange = function(){		
		if(xhr.readyState == 4){
			mText = xhr.responseText;			
			document.getElementById('affichage_construction').innerHTML=mText;
		}
	}
}

function get_cpl(id1, id2, id3) {			
	var xhr = init_ajax();	
	var url = 'pages/ajax_affiche_construction.php?c=' + id1 + '&x=' + id2 + '&y=' + id3 + '&pl=' + document.getElementById('cplan').value;										
	get_ajax(url,xhr);
	xhr.onreadystatechange = function(){		
		if(xhr.readyState == 4){
			mText = xhr.responseText;			
			document.getElementById('affichage_construction').innerHTML=mText;
		}
	}
}

function get_ca(id1) {			
	var xhr = init_ajax();	
	var url = 'pages/ajax_affiche_prix_ca.php?t=' + id1;										
	get_ajax(url,xhr);
	xhr.onreadystatechange = function(){		
		if(xhr.readyState == 4){
			mText = xhr.responseText;			
			document.getElementById('affichage_prix_ca').innerHTML=mText;
		}
	}
}

