// JavaScript Document
function validar() {
   var nombreElement=document.getElementById("nombre");
   var apellidoElement=document.getElementById("apellido");
   var empresaElement=document.getElementById("empresa");
   var telefonoElement=document.getElementById("telefono");
   var emailElement=document.getElementById("email");
   var countryElement=document.getElementById("country");
   var comentarioElement=document.getElementById("comentario");

   if(nombreElement.value=="") {
       alert("Debe Ingresar un Nombre.");
       nombreElement.focus();
       return false;
   }
   
   if(apellidoElement.value=="") {
       alert("Debe Ingresar un Apellido.");
       apellidoElement.focus();
       return false;
   }
   
   if(empresaElement.value=="") {
       alert("Debe Ingresar su Empresa.");
       empresaElement.focus();
       return false;
   }

    if(telefonoElement.value=="") {
       alert("Debe Ingresar un Teléfono.");
       telefonoElement.focus();
       return false;
   }
   
   if(emailElement.value=="") {
       alert("Debe Ingresar un Email.");
       emailElement.focus();
       return false;
   } else {
      if(!IsMail(emailElement.value)) {
         alert("Debe Ingresar un Email Válido.");
         emailElement.focus();
         return false;	 
      }
   }
   
   if(countryElement.value=="") {
       alert("Debe Ingresar su País.");
       countryElement.focus();
       return false;
   }
    if(comentarioElement.value=="") {
       alert("Debe Ingresar un Comentario.");
       comentarioElement.focus();
       return false;
   }   
   
   return true;            
   
}

function IsMail(YourMail) {
	var Template = /^[a-z][a-z-_0-9.]+@[a-z-_=>0-9.]+.[a-z]{2,3}$/i //Formato de direccion de correo electronico
	return (Template.test(YourMail)) ? true : false;
}
