<!--

//********************************************************
//*        Script Feito por Flavio Logullo.              *
//*       CopyRight 2001 © Picture Internet.             *
//********************************************************


// --- INICIO ---


// Rotina de Pular os campos (TELEFONE)

function pulaFone() {
	
	var fone = document.contato.ddd.value;
	
	if (fone.length == 2) {document.contato.telefone.focus();}

}


// Corrigir formulário

function Reseta() {

	document.contato.reset();
	
}


function submete(){

// Checa se a área de contato está selecionada

if (document.contato.assunto.selectedIndex <= 0)
{
alert("Por favor selecione o assunto.");
document.contato.assunto.focus();
return;
}

// Verifica se Nome não está vazio

if (document.contato.nome.value == "")
{
alert("Por favor digite seu nome!");
document.contato.nome.focus();
return;
}


// Verifica se Nome tem mais de tres letras

if (document.contato.nome.value.length < 3)
{
alert("Seu nome deve ter mais de 3 letras.");
document.contato.nome.focus();
return;
}


// Checa se o campo e-mail esta em branco

if (document.contato.email_from.value == "")
{
alert("Por favor digite seu e-mail.");
document.contato.email_from.focus();
return;
}


// Verifica se o email contem @ e pelo menos 1 .

var checkEmail = "@.";
var checkStr = document.contato.email_from.value;
var EmailValid = false;
var EmailAt = false;
var EmailPeriod = false;
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkEmail.length;  j++)
{
if (ch == checkEmail.charAt(j) && ch == "@")
EmailAt = true;
if (ch == checkEmail.charAt(j) && ch == ".")
EmailPeriod = true;
	  if (EmailAt && EmailPeriod)
		break;
	  if (j == checkEmail.length)
		break;
	}

// Se existir @ na string

if (EmailAt && EmailPeriod)
{
		EmailValid = true
		break;
	}
}
if (!EmailValid)
{
alert("Por favor digite um e-mail válido!");
document.contato.email_from.focus();
return;
}

// Verifica se DDD não está vazio

if (document.contato.ddd.value == "")
{
alert("Por favor digite o DDD.");
document.contato.ddd.focus();
return;
}

// Verifica se DDD tem 2 dígitos

if (document.contato.ddd.value.length < 2)
{
alert("O DDD deve ter 2 dígitos.");
document.contato.ddd.focus();
return;
}


// Verifica se o campo DDD contem apenas numeros

var checkOK = "0123456789";
var checkStr = document.contato.ddd.value;
var allValid = true;
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("Por favor digite apenas números no campo \"DDD\".");
document.contato.ddd.focus();
return;
}



// Verifica se TELEFONE não está vazio

if (document.contato.telefone.value == "")
{
alert("Por favor digite Seu Telefone.");
document.contato.telefone.focus();
return;
}

// Verifica se Telefone tem 8 dígitos

if (document.contato.telefone.value.length < 8)
{
alert("O Telefone deve ter 8 dígitos.");
document.contato.telefone.focus();
return;
}


// Verifica se o campo TELEFONE contem apenas numeros

var checkOK = "0123456789";
var checkStr = document.contato.telefone.value;
var allValid = true;
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("Por favor digite apenas números no campo \"Telefone\".");
document.contato.telefone.focus();
return;
}


// Verifica se Mensagem não está vazio

if (document.contato.mensagem.value == "")
{
alert("Por favor digite sua mensagem!");
document.contato.mensagem.focus();
return;
}


// Verifica se Mensagem tem mais de tres letras

if (document.contato.mensagem.value.length < 3)
{
alert("Sua mensagem deve ter mais de 3 letras");
document.contato.mensagem.focus();
return;
}else{

		document.contato.submit();
}

//--- FECHA ---
}

//-->
