// JavaScript Document

var httpObject = null;

/* Check if Enter is pressed */
function CheckKeyCode(keyCode) { 
	if (keyCode == 13 && document.getElementById("yahooid").value != "")	// if enter key press and the field in not null
		Send(); 
}

/* get xml http request */
function GetXMLHttpObject() {
	if (window.ActiveXObject) 
		return new ActiveXObject("Microsoft.XMLHTTP");
	else { 
		if (window.XMLHttpRequest) 
			return new XMLHttpRequest();
	    else {
			alert("Your browser does not support AJAX.");
			return null;
	    }
	}
} 

/* Sends the Message */
function Send() {
	httpObject = GetXMLHttpObject();
		
	if (httpObject != null) {
		url = "getstatus.php?yahooid=" + document.getElementById("yahooid").value;
		
		httpObject.onreadystatechange = ShowResult;
		httpObject.open("GET", url, true);
		httpObject.send(null);
	}
}

function ShowResult() {
	if (httpObject.readyState == 4) {
		document.getElementById("result").innerHTML = httpObject.responseText;
	}
} 