/**
 * Funcion para crear el objeto ajax
 */
function ajax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
} 


/**
 * Funcion que realiza la validación del login
 */
function validarUsuarioCliente() {
	var contenedor = document.getElementById('errorLogin');
	var usuario = document.getElementById('usuario').value;
	var clave = document.getElementById('password').value;
	obj_ajax=ajax();
	obj_ajax.open("POST", "comun/lib/loginClientes.php",true);
	obj_ajax.onreadystatechange=function() {
		if (obj_ajax.readyState==4) {
			contenedor.innerHTML = obj_ajax.responseText;

		}
	}
	obj_ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	obj_ajax.send("usuario="+usuario+"&password="+clave);
}

