
function EseguiQueryAjax(Url,  NomeDiv,  Parametri) {
	// Esegue la query (al termine dell'esecuzione (open) il controllo passa alla funzione handleHttpResponse_ajax(NomeDiv)
	
	Url = Url + "?NomeDiv=" + NomeDiv + "&" +  Parametri

	http_ajax.open("GET", Url, true);
	http_ajax.onreadystatechange =  function()
			{
				handleHttpResponse_ajax(NomeDiv);
			}
	http_ajax.send(null);
	
	}
	
function handleHttpResponse_ajax(NomeDiv)
{

	// Controlla che ci sia un responso dall'oggetto.
	if (http_ajax.readyState == 4) {
	
		// Scompone la stringa ritornata in un array.
		var responseText = http_ajax.responseText;
		
		// Qui viene visualizzato il risultato (soltanto il primo parametro).
		document.getElementById(NomeDiv).innerHTML = responseText;	
		
	} 
}

function getHTTPObject_ajax() {
	// Oggetto XML.
	var xmlhttp;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

var http_ajax = getHTTPObject_ajax(); // We create the HTTP Object
