// JavaScript Document
function enviarConsulta()
{
   var nombre=document.getElementById("txtnombre");
   var telefono=document.getElementById("txttelefono");
   var email1=document.getElementById("txtemail1");
   var email2=document.getElementById("txtemail2");
   var consulta=document.getElementById("txtconsulta");
   
   if(nombre == null || trimAll(nombre.value).length == 0)
   {
      alert('EL CAMPO NOMBRE NO PUEDE ESTAR VACIO');
   }
   else if((telefono == null || trimAll(telefono.value).length == 0) &&
           (email1 == null || trimAll(email1.value).length == 0) )
   {
       alert('DEBE RELLENAR EL CAMPO TELÉFONO O EMAIL');  
   }
   else if(email1 != null && trimAll(email1.value).length != 0 && 
            !comprobarEmail(email1.value))
   {
       alert('EL EMAIL ES INCORRECTO');
   }
   else if(email1.value != trimAll(email2.value))
   {
       alert('LOS DOS E-MAILS NO COINCIDEN');
   }
   else if(consulta == null || trimAll(consulta.value).length == 0)
   {
       alert('EL CAMPO CONSULTA ESTA VACIO, ESCRIBA UNA CONSULTA');
   }
   else
   { 
      var formulario=document.getElementById("formContacto");
      formulario.submit();
   }

}
