var nav4 = window.Event ? true : false;

function acceptNum(evt){	
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	
var key = nav4 ? evt.which : evt.keyCode;	
return (key <= 13 || (key >= 48 && key <= 57));
} 

function comprobar (){
  
    var formato;
  	var comparacion;


    if (document.suscripcion.txtnombre.value == ""){
    	alert("Debe introducir su nombre.");
		  return false;
    }
    

    if (document.suscripcion.txtapellidos.value == ""){
    	alert("Debe introducir sus apellidos.");
		  return false;
    }
    

    if (document.suscripcion.txtnacionalidad.value == ""){
    	alert("Debe introducir su nacionalidad.");
		  return false;
    }


    if (document.suscripcion.txtfechan.value == ""){
    	alert("Debe introducir su fecha de nacimiento.");
		  return false;
    }


    if (document.suscripcion.txtdireccion.value == ""){
    	alert("Debe introducir su dirección.");
		  return false;
    }


    if (document.suscripcion.txttlfmovil.value == ""){
    	alert("Debe introducir su teléfono móvil.");
		  return false;
    }
    
    
     if (document.suscripcion.txttitulo.value == ""){
    	alert("Debe introducir el título.");
		  return false;
    }
    
    if (document.suscripcion.txtprofesor1.value == ""){
    	alert("Debe introducir dos profesores.");
		  return false;
    }

    if (document.suscripcion.txtprofesor2.value == ""){
    	alert("Debe introducir dos profesores.");
		  return false;
    }


    if (document.suscripcion.txtuniversidad1.value == ""){
    	alert("Debe introducir la universidad del profesor "+ document.suscripcion.txtprofesor1.value );
		  return false;
    }
    
     if (document.suscripcion.txtuniversidad2.value == ""){
    	alert("Debe introducir la universidad del profesor "+ document.suscripcion.txtprofesor2.value );
		  return false;
    }


    /*Comprueba que el mail no este vacio*/
    if (document.suscripcion.txtmail.value == ""){
    	alert("Debe introducir su dirección de correo electrónico.");
		  return false;
    }
    /*Comprueba que el mail lleve una @ y que no lleve otra clase de simbolos*/
    else{
    	email = document.suscripcion.txtmail.value;
      	formato = /^([\w-\.])+@([\w-]+\.)+([a-z]){2,4}$/;
     	comparacion = formato.test(email);

      if(comparacion == false){
          alert("Su dirección de correo electrónico no es correcta, introdúzcala de nuevo.");
          return false;
     }
    }

     if (document.suscripcion.txten.value == ""){
    	alert("Debe introducir el lugar donde nos escribe y la fecha.");
		  return false;
    }
    document.suscripcion.submit();
    return false;
  }