function handleHttpResponse() { 
    if (http.readyState == 4) { 
       if (http.status == 200) { 
          if (http.responseText.indexOf('invalid') == -1) {
             // Armamos un array, usando la coma para separar elementos
             results = http.responseText.split(","); 
			 Usuarios="&nbsp;&nbsp;&nbsp;&nbsp;<b>"+results[0]+"</b>";
			 Puntos="<b>"+results[1]+"&nbsp;Puntos&nbsp;&nbsp;&nbsp;</b>"
			 if (results[0]=="NO")
			 {
				 alert('Usuario o Clave incorrectos, Favor reintente')
			 }
			 else
			 {
				 document.getElementById("FormulariodeUsuario").style.display = 'none';
				 document.getElementById("FormulariodeUsuario2").style.display = 'inline';
				 document.getElementById("UsuarioData").innerHTML = Usuarios;
				 document.getElementById("UsuarioPuntos").innerHTML = Puntos;
			 }
             enProceso = false;
          }
       }
    }
}

function VerificaLogin()
	{
		if (document.frmLogin.txtUsuario.value!='' && document.frmLogin.txtPassword.value!='')
		{
			verificaUsuario(document.frmLogin.txtUsuario.value, document.frmLogin.txtPassword.value)
			}	
	}


function verificaUsuario(usuario, password) {
    if (!enProceso && http) {
       var valor1 = escape(usuario);
	   var valor2 = escape(password);
       var url = "consulta.asp?usuario="+valor1+"&password="+valor2;
       http.open("GET", url, true);
       http.onreadystatechange = handleHttpResponse;
       enProceso = true;
       http.send(null);
    }
}

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 enProceso = false; // lo usamos para ver si hay un proceso activo
var http = getHTTPObject(); // Creamos el objeto XMLHttpRequest
var Usuarios = "";
var Puntos = "";

