//create ajax object
function ajax() {
	var xml_http=false;
	try {
		xml_http = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xml_http = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xml_http = false;
		}
	}
	if (!xml_http && typeof XMLHttpRequest!='undefined') {
		xml_http = new XMLHttpRequest();
	}
	return xml_http;
}

//verify email
function check_address(email) {
	xml_http = ajax();
	if (xml_http) {
		url = encodeURI("./mail_check/validate.php?email="+email);
		xml_http.open("GET",url,false);
		xml_http.send(null);
		response = xml_http.responseText; //this should only be "valid" or "invalid"
		if (response == "invalid") {
			alert("Please verify that you have entered a valid email address.");
			return false;
		}
		else return true;
	}
}
