var url = "../existelogin.php?login="; // The server-side script
function handleHttpResponse() {
  if (http.readyState == 4) {
    results = http.responseText.split("|");
	resultado = results[0];
	if(resultado != '') {
		document.getElementById('avisologin').innerHTML = results[1];
		if(resultado == 'no') {
			document.getElementById('avisologin').style.color = '#ff0000';
			document.getElementById('submit').style.color = '#888888';
		} else {
			document.getElementById('avisologin').style.color = '#009900';
			document.getElementById('submit').style.color = '#000000';
		}
		document.getElementById('avisologin').style.background = 'transparent';
	}
  }
}
function revisaLogin() {
	try {
	 var loginelegido = document.getElementById("login").value;
	 document.getElementById('avisologin').style.color = '#999999';
	 if(loginelegido != "") {
		document.getElementById('avisologin').style.background = 'transparent url(archivos/espera2.gif) no-repeat center left';
		document.getElementById('avisologin').style.padding = '0 0 0 24px';
	 
		http.open("GET", url + escape(loginelegido), true); 
	 	http.onreadystatechange = handleHttpResponse; 
	 	http.send(null);
	 } 
	} catch (e) {
		setTimeout("revisaLogin()", 400);
	}
}
function getHTTPObject() { 
	var xmlhttp; 
	/*@cc_on 
	@if (@_jscript_version >= 5) try { 
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
	} catch (e) { 
		try { 
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
		} catch (E) { 
			xmlhttp = false; 
		} 
	} @else xmlhttp = false; 
	@end 
	@*/  
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest(); 
		} catch (e) { 
			xmlhttp = false; 
		} 
	} 
	return xmlhttp; 
} 
var http = getHTTPObject(); // We create the HTTP Object 