// CREAZIONE DELLA CHIAMATA AJAX
function ajaxGetXmlHttpObject(){
	var xmlHttp=null;
	try{
  		// Firefox, Opera 8.0+, Safari
  		xmlHttp=new XMLHttpRequest();
	}catch(e){
		// Internet Explorer
  		try{
    		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    	}catch (e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

var ajaxCallFun = [];

function ajaxCall(url,parameters,fun){
				
	xmlHttp=ajaxGetXmlHttpObject();
	
	if (xmlHttp==null){
		popupCall('/App/ajax/errore.asp',false,'pass');
		return;
	} 
	
	xmlHttp.open('POST', url, true);
	xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
	xmlHttp.setRequestHeader("Content-length", parameters.length);
	xmlHttp.setRequestHeader("Connection", "close");
	
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){//Loaded -- l'operazione è stata completata
			if(xmlHttp.status == 200){
				fun(xmlHttp.responseText);
			}else{
				test?alert('Operazione Ajax fallita, errore numero '+xmlHttp.status):null;
			}
		}
	}
	xmlHttp.send(parameters);
	
}


