// JavaScript Document
<!--
function fale_Validator(theForm)
	{

	var alertsay = ""; // define for long lines
	// alertsay is not necessary for your code,
	// but I need to break my lines in multiple lines
	// so the code won't extend off the edge of the page
	// check to see if the field is blank
	if (theForm.nome.value == "")
		{
		alert("Por favor, informe seu nome.");
		theForm.nome.focus();
		return (false);
		}

	// require at least 3 characters be entered
	if (theForm.nome.value.length < 5)
		{
		alert("Por favor, informe seu \"nome\".");
		theForm.nome.focus();
		return (false);
		}

	// allow ONLY alphanumeric keys, no symbols or punctuation
	// this can be altered for any "checkOK" string you desire
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
	var checkStr = theForm.nome.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
		{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
			{
			allValid = false;
			break;
			}
		}
	if (!allValid)
		{
		alert("Caracteres inválidos no campo \"nome\". Por favor, informe seu nome.");
		theForm.nome.focus();
		return (false);
		}

	// require a value be entered in the obs field
	if (theForm.obs.value == "")
		{
		alert("Por favor, deixe seu comentário.");
		theForm.obs.focus();
		return (false);
		}

	// require a value be entered in the field
	if (theForm.telefone.value == "")
		{
		alert("Por favor, informe um \"telefone\".");
		theForm.telefone.focus();
		return (false);
		}

	// require that at least one character be entered
	if (theForm.telefone.value.length < 8)
		{
		alert("Por favor informe um \"telefone\".");
		theForm.telefone.focus();
		return (false);
		}

	// don't allow more than 5 characters be entered
	if (theForm.telefone.value.length > 14)
		{
			 alertsay = "Número inválido!"
			 alertsay = alertsay + "Por favor, inclua um \"telefone\" válido."
		alert(alertsay);
		theForm.telefone.focus();
		return (false);
		}

	// only allow 0-9, - and () be entered
	var checkOK = "0123456789-() ";
	var checkStr = theForm.telefone.value;
	var allValid = true;
	var decPoints = 0;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
		{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
			{
			allValid = false;
			break;
			}
		if (ch != ",")
		allNum += ch;
		}
	if (!allValid)
		{
		alert("Telefone inválidos, por favor digite um \"telefone\".");
		theForm.telefone.focus();
		return (false);
		}



	return (true);
	}

