////////////////////////////////
///    LLENA CAMPOS SELECT   ///
////////////////////////////////
//
//
////////////////////////////////
///  VERIFICA CAMPOS LLENOS  ///
////////////////////////////////
//
//
//~~Verifica nuevo usuario
function verifica_email() {
 var cad  = '';
 var ban  = 0;
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.email.value)){
     //alert("La dirección de email " + valor    + " es correcta.") 
	 //return (true)
 } else {
     cad += "Escribe tu correo\n";
	 ban++;
 }
 if (ban != 0) {
     alert(cad);
     return false;
 } else {
	 //Ajax para hacer la consulta a la tabla
	 ajax = nuevoAjax();
	 var email   = document.form1.email.value;
	 ajax.open("GET", "email_repeat.php?email="+email,true);
	 ajax.onreadystatechange = function() {
		if (ajax.readyState==4) {
			var arreglo = ajax.responseText.split("rbnrbn");
			document.form1.res.value = arreglo[0];
		}
	 }
	 ajax.send(null);
	 setTimeout("email_time();",1500);
 }
}
//Complemento de verifica_equipo_new() y verifica_equipo_edit(), muestra el mensaje correspondiente
function email_time() {
	var id = document.form1.res.value;
	switch(id) {
	  case '0': document.form1.method = 'post';
	            document.form1.action = 'salva_email.php';
				document.form1.submit();
			  break;
	  case '1': alert('Este correo ya esta registrado. Intente con otro');
	          break;
	}
}
//
//
//
//
//~~Verifica nuevo usuario
function verifica_email2() {
 var cad  = '';
 var ban  = 0;
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.email.value)){
     //alert("La dirección de email " + valor    + " es correcta.") 
	 //return (true)
 } else {
     cad += "Write your email\n";
	 ban++;
 }
 if (ban != 0) {
     alert(cad);
     return false;
 } else {
	 //Ajax para hacer la consulta a la tabla
	 ajax = nuevoAjax();
	 var email   = document.form1.email.value;
	 ajax.open("GET", "email_repeat.php?email="+email,true);
	 ajax.onreadystatechange = function() {
		if (ajax.readyState==4) {
			var arreglo = ajax.responseText.split("rbnrbn");
			document.form1.res.value = arreglo[0];
		}
	 }
	 ajax.send(null);
	 setTimeout("email_time2();",1500);
 }
}
//Complemento de verifica_equipo_new() y verifica_equipo_edit(), muestra el mensaje correspondiente
function email_time2() {
	var id = document.form1.res.value;
	switch(id) {
	  case '0': document.form1.method = 'post';
	            document.form1.action = 'salva_email2.php';
				document.form1.submit();
			  break;
	  case '1': alert('This email account already exists.  Please try another.');
	          break;
	}
}
//
//
////////////////////////////////
///          STUFF           ///
////////////////////////////////
//
//
////////////////////////////////
///        GENERICAS         ///
////////////////////////////////
//
//
///////////////////////////////////////////
//             SECCION DE AJAX           //
///////////////////////////////////////////
//
//
//Crea objeto Ajax
function nuevoAjax(){
	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;
}
//
//