// js handling the login procedures

// constants
var NORMAL_STATE = 4;
//var LOGIN_PREFIX = 'http://localhost/classificanet/security.asp?';
var LOGIN_PREFIX = '/security.asp?';

// variables
var http = getHTTPObject(); // We create the HTTP Object
var messages = '';

// validates a login request
function verificarUsuario()
{
	email = escape(document.getElementById('email').value);

	if (email != '') {
		http.open('GET', LOGIN_PREFIX + 'acao=verificarUsuario&email='+email, true);
		http.onreadystatechange = handleHttpVerificarUsuario;
		http.send(null);
	}
}

// called when the validation results are returned from the server
function handleHttpVerificarUsuario()
{
		if (http.readyState == NORMAL_STATE) {
		results = http.responseText.split('|');

		if (results[0] == 'true')
		{
			window.location='/verificar.asp?acao=cadastrado';
		}
	}
}