// JavaScript Document
function validar_envio_mensaje(theForm){
	
	if (theForm.nombre.value == ""){
		alert("El nombre es un dato requerido.");
		theForm.nombre.focus();
		return (false);
	}
	
	if (theForm.email.value == ""){
		alert("Su dirección de correo es un dato requerido.");
		theForm.email.focus();
		return (false);
	}

	email = theForm.email.value;
	email = email.toLowerCase();			

	if ( email.search("@") != -1 ){
	}
	else{
		alert("La dirección de correo ingresada no es válida.");
		theForm.email.focus();
		return (false);				
	}

	if (theForm.mensaje.value == ""){
		alert("El mensaje es un dato requerido.");
		theForm.mensaje.focus();
		return (false);
	}
	
	if (theForm.guess.value == "Ingrese el código aquí"){
		alert("El código de seguridad es un dato requerido.");
		theForm.guess.focus();
		return (false);
	}

	
	return (true);

}

// JavaScript Document
function validar_envio_mensaje_pie_pagina(theForm){
	
	if (theForm.nombre.value == ""){
		alert("El nombre es un dato requerido.");
		theForm.nombre.focus();
		return (false);
	}
	
	if (theForm.email.value == ""){
		alert("Su dirección de correo es un dato requerido.");
		theForm.email.focus();
		return (false);
	}

	email = theForm.email.value;
	email = email.toLowerCase();			

	if ( email.search("@") != -1 ){
	}
	else{
		alert("La dirección de correo ingresada no es válida.");
		theForm.email.focus();
		return (false);				
	}

	if (theForm.mensaje.value == ""){
		alert("El mensaje es un dato requerido.");
		theForm.mensaje.focus();
		return (false);
	}
		
	return (true);

}

function validar_newsletter(theForm){
	if(theForm.nombre_y_apellido_newsletter.value == ""){
		alert("Su nombre es un dato requerido.");
		theForm.nombre_y_apellido.focus();
		return(false);
	}
	
	if (theForm.email_newsletter.value == ""){
		alert("Su dirección de correo es un dato requerido.");
		theForm.email_newsletter.focus();
		return (false);
	}

	/*  validacion que requiere todos los caracteres @ y el punto y las letras que continua al punto */
	email = theForm.email_newsletter.value;

	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
	}
	else{
		alert("La dirección de email es incorrecta.");
		theForm.email_newsletter.focus();
		return (false);
	}	
	
	return(true);
}

/*FORMULARIO DE CONSULTA DE TASACIONES*/
function validar_contacto(theForm){

	if (theForm.nombre.value == ""){
		alert("Su nombre es un dato requerido.");
		theForm.nombre.focus();
		return (false);
	}
	
	
	if (theForm.email.value == ""){
		alert("Su direcci\xF3n de correo es un dato requerido.");
		theForm.email.focus();
		return (false);
	}
	
	email = theForm.email.value;
	email = email.toLowerCase();			
	
	if ( email.search("@") != -1 ){
	}
	else{
		alert("La direcci\xF3n de correo ingresada no es v\xE1lida.");
		theForm.email.focus();
		return (false);				
	}
	
	if (theForm.consulta.value == ""){
		alert("Su consulta es un dato requerido.");
		theForm.consulta.focus();
		return (false);
	}

	if (theForm.guess.value == ""){
		alert("Debe ingresar el c\xF3digo de seguridad que se muestra.");
		theForm.guess.focus();
		return (false);
	}
	
	return (true);
}

/*CURRICULUM*/

   function validar_curriculum(theForm){
	
		
		if (theForm.apellido.value == ""){
			alert("Su apellido es un dato requerido");
			theForm.apellido.focus();
			return (false);
		}
		
 		if (theForm.nombre.value == ""){
			alert("Su nombre es un dato requerido.");
			theForm.nombre.focus();
			return (false);
		}
		
		if (theForm.edad.value == ""){
			alert("Su edad es un dato requerido.");
			theForm.edad.focus();
			return (false);
		}
		else{
			if(isNaN (theForm.edad.value)){
				alert("La edad debe ser un dato numérico.");
				theForm.edad.focus();
				return (false);
			}	
		}
			
 		if (theForm.email.value == ""){
			alert("Su dirección de correo es un dato requerido.");
			theForm.email.focus();
			return (false);
		}

		email = theForm.email.value;
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
		}
		else{
			alert("La dirección de email es incorrecta.");
			theForm.email.focus();
			return (false);
		}	

 		if (theForm.estudios.value == ""){
			alert("Sus estudios cursados es un dato requerido.");
			theForm.estudios.focus();
			return (false);
		}
		
		if (theForm.experiencia_laboral.value == ""){
			alert("Su experiencia laboral es un dato requerido.");
			theForm.experiencia_laboral.focus();
			return (false);
		}
		
		if(theForm.referencias.value == ""){
			alert("Las referencias es un dato requerido.");
			theForm.referencias.focus();
			return (false);
		}
		
		if(theForm.foto.value == ""){
			alert("La foto es requerida.");
			theForm.foto.focus();
			return(false);
		}
		
		if (theForm.guess.value == ""){
		alert("Debe ingresar el código de seguridad que se muestra.");
		theForm.guess.focus();
		return (false);
	}
	
	
	return (true);
}

