
// da wikipedia.org/wiki/XMLHttpRequest
if (typeof XMLHttpRequest == "undefined") {
	XMLHttpRequest = function () {
		try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }
			catch (e) {}
		try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }
			catch (e) {}
		throw new Error("This browser does not support XMLHttpRequest.");
	}
}

function ajaxR_pass_send(id) {
	var ajaxRequest;
	try {
		// w3.org (Opera 8.0+, Firefox, Safari)
		ajaxRequest = new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer Browsers
		try {
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				// Something went wrong
				alert("Questo browser non supporta ActiveX!?!");
				return false;
			}
		}
	}
		
	var url = "ajax/pass_send.php";
	var queryString = "?id=" + id;
		
	try { ajaxRequest.open("GET", url + queryString, false);
	} catch (e) { alert(e); }
	try { ajaxRequest.send(null);
	} catch (e) { alert(e); }
		
	var resp = ajaxRequest.responseText;
	if (resp.indexOf("true") > -1)
		return true;
	else
		return false;
}

function ajaxR_pass_forum_mod(id,pass) {
	var ajaxRequest;
	try {
		// w3.org (Opera 8.0+, Firefox, Safari)
		ajaxRequest = new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer Browsers
		try {
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				// Something went wrong
				alert("Questo browser non supporta ActiveX!?!");
				return false;
			}
		}
	}
		
	var url = "ajax/pass_forum_mod.php";
	var queryString = "?id=" + id + "&pass=" + pass;
		
	try { ajaxRequest.open("GET", url + queryString, false);
	} catch (e) { alert(e); }
	try { ajaxRequest.send(null);
	} catch (e) { alert(e); }
		
	var resp = ajaxRequest.responseText;
	if (resp.indexOf("true") > -1)
		return true;
	else
		return false;
}

function ajaxR_corista_pass(id,pass) {
	var ajaxRequest;
	try {
		// w3.org (Opera 8.0+, Firefox, Safari)
		ajaxRequest = new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer Browsers
		try {
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				// Something went wrong
				alert("Questo browser non supporta ActiveX!?!");
				return false;
			}
		}
	}
		
	var url = "ajax/corista_pass.php";
	var queryString = "?id=" + id + "&pass=" + pass;
		
	try { ajaxRequest.open("GET", url + queryString, false);
	} catch (e) { alert(e); }
	try { ajaxRequest.send(null);
	} catch (e) { alert(e); }
		
	var resp = ajaxRequest.responseText;
	if (resp.indexOf("true") > -1)
		return true;
	else
		return false;
}

function ajaxR_pass(id,pass) {
	var ajaxRequest;
	try {
		// w3.org (Opera 8.0+, Firefox, Safari)
		ajaxRequest = new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer Browsers
		try {
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				// Something went wrong
				alert("Questo browser non supporta ActiveX!?!");
				return false;
			}
		}
	}
		
	var url = "ajax/pass.php";
	var queryString = "?id=" + id + "&pass=" + pass;
		
	try { ajaxRequest.open("GET", url + queryString, false);
	} catch (e) { alert(e); }
	try { ajaxRequest.send(null);
	} catch (e) { alert(e); }
		
	var resp = ajaxRequest.responseText;
	if (resp.indexOf("true") > -1)
		return true;
	else
		return false;
}

// verifica se un indirizzo web risponde
function ajaxR_url(link,send) {
	var ajaxRequest;
	try {
		// w3.org (Opera 8.0+, Firefox, Safari)
		ajaxRequest = new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer Browsers
		try {
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				// Something went wrong
				alert("Questo browser non supporta ActiveX!?!");
				return false;
			}
		}
	}
		
	var url = "ajax/check_url.php";
	var queryString = "?link=" + link + "&send=" + send;
		
	try { ajaxRequest.open("GET", url + queryString, false);
	} catch (e) {}
	try { ajaxRequest.send(null);
	} catch (e) {}
		
	var resp = ajaxRequest.responseText;
	if (resp.indexOf("true") > -1)
		return true;
	else
		return false;
}

// salva un valore nella sessione
function ajaxSaveS(p,v) {
	//alert('ajaxSaveS: ' + p + '=' + v);
	var ajaxRequest;
	try {
		// w3.org (Opera 8.0+, Firefox, Safari)
		ajaxRequest = new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer Browsers
		try {
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				// Something went wrong
				alert("Questo browser non supporta ActiveX!?!");
				return false;
			}
		}
	}

	var url = "ajax/saves.php";
	var queryString = "?p=" + p + "&v=" + v;
	//alert(url + queryString)
	
	try { ajaxRequest.open("GET", url + queryString, false);
	} catch (e) {}
	try { ajaxRequest.send(null);
	} catch (e) {}
}

// verifica il percento di upload
function ajaxR_progress() {
	var ajaxRequest;
	try {
		// w3.org (Opera 8.0+, Firefox, Safari)
		ajaxRequest = new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer Browsers
		try {
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				// Something went wrong
				alert("Questo browser non supporta ActiveX!?!");
				return false;
			}
		}
	}
		
	var url = "ajax/progress.php";
	try { ajaxRequest.open("GET", url, false);
	} catch (e) {}
	try { ajaxRequest.send(null);
	} catch (e) {}
		
	var resp = ajaxRequest.responseText;
	return resp;
}

