function validaEmail(checkStr)
{var nI, sS, nN, nP;
 // Arroba ...
 sS = "@"; nN = 0; nP = 0;
 for(nI = 0; nI <checkStr.length; nI++)
 { if(checkStr.charAt(nI) == sS) 
 { nN++; nP = nI; }
 }
 if(nN == 0) return (false);
 if(nN> 1) return (false);
 var nPArroba = nP;
 // Punto ...
 sS = "."; nN = 0; nP = 0;
 for(nI = 0; nI <checkStr.length; nI++)
 { if(checkStr.charAt(nI) == sS) 
 { nN++; nP = nI; }
 }
 if(nN == 0) return (false);
 var nPPunto = nP;
 // Posicion Arroba/Punto ...
 if(nPArroba> nPPunto) return (false);
 //
 return (true);
}

function IsNumeric(valor) 
	{ 
		var log=valor.length; var sw="S"; 
		for (x=0; x<log; x++) 
			{ v1=valor.substr(x,1); 
			v2 = parseInt(v1); 
			//Compruebo si es un valor numérico 
			if (isNaN(v2)) { sw= "N";} 
			} 
			if (sw=="S") {return true;} else {return false; } 
	}

function GuardarConsulta(){
	if (!document.forms['f'].priv.checked)
	alert("Por favor, debes acepatar la política de privacidad.");
	else
	{
with(document.forms['f']){
 if ((nombre.value=="")){ alert("Por favor, debes indicar un Nombre."); nombre.focus(); }
 else
 if ((telefono.value=="")){ alert("Por favor, debes indicar el teléfono."); telefono.focus(); }
 else
 if (!IsNumeric(telefono.value)) {alert("El teléfono ha de ser un número."); telefono.focus(); }
 else
 if ((telefono.value.length)<9) { alert("El teléfono ha de tener 9 cifras como mínimo"); telefono.focus(); }
 else
 if ((email.value=="")){ alert("Por favor, debes indicar un E-mail."); email.focus(); }
 else 
 if (!validaEmail(email.value)){ alert("El E-mail introducido tiene un formato incorrecto."); email.focus(); }
 else
 if ((mensaje.value=="")){ alert("Por favor, debes indicar la consulta."); mensaje.focus(); }
 else
 submit();
 }
}
return false;
}
