 function makePOSTRequest(url,parameters,id_div_output,notify_waiting,re_function,objRE) {
        var http_request = false;
        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
		if(notify_waiting){
			document.getElementById(id_div_output).innerHTML='<div style="margin:0 auto;width:20px;padding:20px;text-align:center"><img src="img/loading.gif" /></div>';
		}
		http_request.open("POST", url, true);
		http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        http_request.onreadystatechange = function() { alertContents(http_request,id_div_output,re_function,objRE); };
		http_request.send(parameters);

    }

    function alertContents(http_request,output,funzioni,obj_esito) {

        if (http_request.readyState == 4) {
		//Stato OK
		if (http_request.status == 200) {
			//alert(xmlHttp.responseText);
			var resp = http_request.responseText;	
			if(resp == "RICARICAMENTO_PAGINA"){
				window.location.reload(true);
			}
			else{
				var cont = document.getElementById(output);
				//alert(ricarica);
				cont.innerHTML = resp;	
				if(ricarica){ 
					//ridisegna il box cartone che altrimenti non aggiorna la sua posizione
					//document.getElementById('boxcartone').innerHTML = divCartone;
					makePOSTRequest('../../blocco.php', "file=cartone",'boxcartone',true,"init();");
					ricarica = false;
				}
				if(funzioni)
				{
					if(obj_esito) 
						objEsito = document.getElementById(obj_esito);
					else
						objEsito = document.getElementById("esito");
					re = 1;
					if(objEsito){	
						re = objEsito.innerHTML;
					}
					eval(funzioni);
				}
			}
		}
		waiting = false;
		
	
        }

    }

