// Formulario del footer

function enviar_formulario() {

	 if (validacion()) {

		document.getElementById("modulo").submit();

        return true; 

	 }

	 return false;

}



function validacion() {

	 var nom = document.getElementById("txtnombre1").value;

	 var ape = document.getElementById("txtapaterno1").value;

	 var m   = document.getElementById("txtcorreocliente1").value;

	 var tel = document.getElementById("txttelefono1").value;

	 var men = document.getElementById("txtcomentarios1").value;



     if (nom.trim() == "" || nom == "Nombre")    { document.getElementById("spnError").innerHTML = "<br />Debe introducir su nombre.<br />"; return false;}

	 if (ape.trim() == "" || ape == "Apellido")  { document.getElementById("spnError").innerHTML = "<br />Debe introducir sus apellidos.<br />"; return false;}

	 if (m != "") {

     	if ( !m.esEmail() ) { document.getElementById("spnError").innerHTML = "<br />La cuenta de correo electr&oacute;nico no es correcta.<br />"; return false; }   

	 }else{

		document.getElementById("spnError").innerHTML = "<br />Debe introducir un correo electr&oacute;nico.<br />"; return false; 

	  }	 

	 if (men.trim() == "" || men == "Mensaje")    { document.getElementById("spnError").innerHTML = "<br />Debe introducir un mensaje.<br />"; return false;}	 

     if (tel == "tel") { tel.value = ""; }

	 return true;  // no existen errores  :)

}



// Formulario de contactos normal

function enviar() {

	 if (valida()) {

		document.getElementById("frmContacto").submit();

        return true; 

	 }

	 return false;

}



function valida() {

	 var m = document.getElementById("txtcorreocliente").value;



     if (document.getElementById("txtnombre").value.trim() == "")    { document.getElementById("spnError2").innerHTML = "<br />Debe introducir su nombre.<br />"; return false;}

	 if (document.getElementById("txtapaterno").value.trim() == "")  { document.getElementById("spnError2").innerHTML = "<br />Debe introducir su apellido paterno.<br />"; return false;}

	 if (document.getElementById("txtamaterno").value.trim() == "")  { document.getElementById("spnError2").innerHTML = "<br />Debe introducir su apellido materno.<br />"; return false;}

	 if (m != "") {

     	if ( !m.esEmail() ) { document.getElementById("spnError2").innerHTML = "<br />La cuenta de correo electr&oacute;nico no es correcta.<br />"; return false; }   

	 }else{

		document.getElementById("spnError2").innerHTML = "<br />Debe introducir un correo electr&oacute;nico.<br />"; return false; 

	  }	 

	 if (document.getElementById("txttelefono").value.trim() == "") { document.getElementById("spnError2").innerHTML = "<br />Debe introducir un n&uacute;mero tel&eacute;fonico.<br />"; return false;} 

	 if (document.getElementById("txtempresa").value.trim() == "")  { document.getElementById("spnError2").innerHTML = "<br />Debe introducir el nombre de su empresa.<br />"; return false;}

	// if (document.getElementById("txtcomentarios").value.trim() == "") { document.getElementById("spnError2").innerHTML = "<br />Debe introducir un comentario.<br />"; return false;}

  

	 return true;  // no existen errores  :)

}