
//VALIDACION DE LOS CAMPOS DEL FORMULARIO DE CONTACTO


function validarEmail(valor) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
   		return (true);
 	} else {
   		return (false);
  	}
}

function validar(){
	//valido el nombre
    	if (document.formulario.nombre.value.length==0){
       		alert("Debe ingresar su nombre.") ;
       		document.formulario.nombre.focus() ;
   		return (false);
	}

	//valido e-mail
    	email = document.formulario.email.value;
    	if (! validarEmail(email)) {
		alert("Debe ingresar un correo electrónico válido.");
       		document.formulario.email.focus();
   		return (false);
    	}

    	//el formulario se envia
//    	document.formulario.submit();
	return (true);
} 
