function validarEmail(valor) {
	return (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(valor))
}	

// JavaScript Document
function objetoAjax() {
	var xmlhttp=false;
    /*this.AjaxFailedAlert = "Su navegador no soporta las funciónalidades de este sitio
		 y podria experimentarlo de forma diferente a la que fue pensada.
		 Por favor habilite javascript en su navegador para verlo normalmente.\n";
    this.requestFile = file;
    this.encodeURIString = true;
    this.execute = false;*/
   
    if (window.XMLHttpRequest) { // Si es mozilla, Safari, etc
        xmlhttp = new XMLHttpRequest();
        if (xmlhttp.overrideMimeType) {
            xmlhttp.overrideMimeType('text/xml'); // Visualizacion caracteres
        }
    } 
    else if (window.ActiveXObject) { // pero si es IE
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        }catch (e){
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // en caso que sea una versión antigua
            } catch (e) {
                xmlhttp = null;
            }
        }
        
		/*if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
            this.xmlhttp = new XMLHttpRequest();
            if (!this.xmlhttp){
                this.failed = true; 
            }
        } */
    }
    return xmlhttp ;
}

function ErrorAjax()
{
	alert("El navegador no puede ejecutar funciones de javascript, es posible que su explorador sea muy antiguo.");
}


/*function MandarPass()
{
	window.open("OlvidarContrasena.php", "black", "location=0, status=0, menubar=0,titlebar=1, toolbar=0, width=450, top=200, height=300,left=200");

}

function mandarContrasena()
{
	if(document.getElementById("email1").value=="") {
		alert("Debe introducir una correo electronico.");
		return;
	}

	if(!validarEmail(document.getElementById("email1").value)) {
		alert("Formato de Correo Electronico erroneo.");
		return;		
	}
	
	if(document.getElementById("email1").value!=document.getElementById("email2").value) {
		alert("Las cuentas de correo electronico no son iguales.")
		return;
	}
		
	var ajax=objetoAjax();	
	if (!ajax){
		ErrorAjax()
	}else{
		strUrl="ajax/correoRecordarContrasena.php?email="+document.getElementById("email2").value;
		ajax.open("POST", strUrl);
		ajax.onreadystatechange = function()
		{
			if (ajax.readyState == 4) {
					// Funcion que retorna
				if (ajax.status==200){
					alert(ajax.responseText);
				}else if (ajax.readyState==404){
					alert("Archivo no encontrado");
				}else{
					alert("Error ajax  : " + ajax.readyState);
				}			
			}
		};
		ajax.send(null);	
	}
}
*/

