/* ---------------------------- */
/*     XMLHTTPRequest Enable    */
/* ---------------------------- */
function createObject() {
	var request_type;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		request_type = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		request_type = new XMLHttpRequest();
	}
	return request_type;
}

var http = createObject();
var nocache = 0;
/* ---------------------------- */
/*  fine XMLHTTPRequest Enable  */
/* ---------------------------- */

// CARICA SOTTOPAGINE
function caricaSottopagine(divAjax, file, query) {
	nocache = Math.random();
	http.open('get','/ajax/'+file+'.php?nocache='+nocache+'&'+query);
	http.onreadystatechange = function ReplyCarica() {
					if(http.readyState == 4){
						var response = http.responseText;
						document.getElementById(divAjax).innerHTML = '';
						document.getElementById(divAjax).innerHTML = response;
					}
				  }
	http.send(null);
}
// fine CARICA SOTTOPAGINE

function isEmail(what) {
	var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	if(!i.test(what)) { alert("L'e-mail inserita non risulta valida.\n(Esempio: nome@provider.tld)"); return false; }
	return true;
}
