// variabile globale
var xmlHttp

function getXmlHttpObject(){
	// variabile locale
	var xhr;
	
	if(window.XMLHttpRequest){
		// compatibilità con IE7+, Firefox, Chrome, Opera, Safari
		try{
			// tento ad istanziare l'oggetto
			xhr = new XMLHttpRequest();
			return xhr;
		} catch(e) {
			xhr = null;
		}
	}
	if(window.ActiveXObject){
		// compatibilità con IE5, IE6
		try{
			// in questo caso si tratta di un ActiveX
			xhr = new ActiveXObject();
			return xhr;
		} catch(e) {
			xhr = null;
		}
	}
	
	return xhr;
}
