//---------  Creating  AJAX object	-----------------------------
function createXmlHttpRequestObject() {
	var xmlHttp;
	if(window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else { 
		xmlHttp = new XMLHttpRequest();
	}
	return xmlHttp;
}

var xmlHttp ;


function checkUserID() {
	email = encodeURIComponent(document.getElementById('Email').value);
	if (email == '') {
		alert ("Please enter your email address.");
		return;
	}
	xmlHttp = createXmlHttpRequestObject();
	xmlHttp.onreadystatechange = handleUserIDCheckData;
	xmlHttp.open("GET", "ajax.php?email=" + email, true);
	xmlHttp.send(null);
}

function handleUserIDCheckData() {
	if (xmlHttp.readyState == 4 ) {
		if (xmlHttp.status == 200) {
			returnedvalue = xmlHttp.responseText;
			if(returnedvalue == "no") {
				alert("This User ID is already in use.");
			} else {
				alert("This User ID is available.");
			}
		}
	}
}





