var arrayComponent=["MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","MICROSOFT.XMLHTTP.1.0","MICROSOFT.XMLHTTP.1","MICROSOFT.XMLHTTP"]; function selectObj() {var dd=null;for(var cc=0;cc<arrayComponent.length;cc++){try {dd=new ActiveXObject(arrayComponent[cc]);break;}catch(c){dd=null;}}if(typeof XMLHttpRequest!="undefined" || !dd){try{dd=new XMLHttpRequest();}catch(e){alert("Impossibile create una connessione HTTP! Nessun componente XML installato! ("+e.message+")");}}return dd;}

function openXML(url,obj,typeResponse,typeSend,idDinOnOper,funcToSend,postValue) {
	innerData(idDinOnOper,"Caricamento Dati ...")
	if(typeof typeSend=="undefined" || typeSend.length<=0){typeSend='GET';}
	if(typeof postValue=="undefined" || postValue.length<=0){postValue=null;}else{postValue=encodeURIComponent(postValue);}
	typeSend=typeSend.toUpperCase();
	if(obj && obj.readyState!=0){obj.abort();}
	var timeLoadingtemp=(new Date()).getTime();
	url=url+"?tm="+encodeURIComponent(timeLoadingtemp);
	obj.open(typeSend,url,true);
	if(typeSend=='POST'){obj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");}
	obj.setRequestHeader("Cache-Control","no-cache");obj.setRequestHeader("Pragma","no-cache");obj.setRequestHeader("Cache-Control","no-store");
	obj.setRequestHeader("Expires","Wed, 31 Dec 1980 00:00:00 GMT");
	obj.onreadystatechange=function(){
		rv=obj.readyState;
		if(rv==4){
			if (obj.status==200){
				var txtR='txt';if(typeResponse=="xml"){txtR=obj.responseXML}else{txtR=obj.responseText};
				timeLoading=((new Date()).getTime())-timeLoadingtemp;timeLoading=timeLoading/1000;timeLoading=timeLoading.toString()+" sec.";
				txtR=txtR.replace(/[\n\r]+/g,"");
				eval(funcToSend+',\''+txtR+'\');');
			}else{
				innerData(idDinOnOper,"<strong>Caricamento Fallito ...</strong>")
				alert("Status Error n."+obj.status);
			}
		}
	};
	if(typeSend=='POST'){obj.send(postValue);}else{obj.send(null);}
}

function innerData(strIdDiv,strVal) {var d=document.getElementById(strIdDiv);if (d) {d.innerHTML=strVal;}}
