// JavaScript Document

function Aviso()
	{
		alert("Estamos em manutenção no momento");
	}

////////////////////////////////////////////////////////////////////////////////////
/// FORMULARIO DE CONTATO DO SITE
//////////////////////////////////////////////////////////////////////////////////
function EnviaForm()
{
	var formulario_contato = document.getElementById('Contatos_');
	
	if (Validaformulario_contato())
	{
	    formulario_contato.action = 'Insert_Contatos.php';
	    formulario_contato.submit();
		alert("Formulario enviado com sucesso, breve responderemos seu contato.");
	}
}
function Validaformulario_contato()
{
	var formulario_contato = document.getElementById('Contatos_');
	$foo("#resposta").fadeIn("slow");
	
	if (formulario_contato.txt_nome.value == "")
	{
		//alert("O campo Nome é obrigatório para enviar!");
		formulario_contato.txt_nome.focus();
		document.getElementById("resposta").innerHTML = "Por favor, preencha o campo Nome!";
		setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",4000);
		return false;
	}
	
		if (formulario_contato.txt_email.value == ""){
					   document.getElementById("resposta").innerHTML = "Por favor, preencha o campo E-mail!";
					   setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",4000);
					   formulario_contato.txt_email.focus();
					   return false;
			 }
			 //validar email(verificao de endereco eletrônico)
			 parte1 = formulario_contato.txt_email.value.indexOf("@");
			 parte2 = formulario_contato.txt_email.value.indexOf(".");
			 parte3 = formulario_contato.txt_email.value.length;
			 if (!(parte1 >= 3 && parte2 >= 6 && parte3 >= 9)) {
					   document.getElementById("resposta").innerHTML = "Por favor, digite um E-mail válido!";
					   setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",3000);
					   formulario_contato.txt_email.focus();
					   return false;
			 }
		 
				 if (formulario_contato.txt_telefone.value == ""){
							   document.getElementById("resposta").innerHTML = "Por favor, preencha o campo Telefone!";
								setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",3000);
							   formulario_contato.txt_telefone.focus();
							   return false;
					 }
         //validar telefone(verificacao se contem apenas numeros)
						 if (isNaN(formulario_contato.txt_telefone.value)){
								  document.getElementById("resposta").innerHTML = "O campo Telefone deve conter apenas números";
									setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",3000);
								  formulario_contato.txt_telefone.focus();
								   return false;
						 }
						 
							if (formulario_contato.txt_cidade.value == ""){
									   document.getElementById("resposta").innerHTML = "Por favor, preencha o campo Cidade!";
										setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",3000);
									   formulario_contato.txt_cidade.focus();
									   return false;
							 }
		 
								 if (formulario_contato.txt_estado.value == ""){
										   document.getElementById("resposta").innerHTML = "Por favor, preencha o campo Estado!";
										   setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",3000);
										   formulario_contato.txt_estado.focus();
										   return false;
								 }
		 
		  
		
									if (formulario_contato.txt_assunto.value == ""){
											   document.getElementById("resposta").innerHTML = "Por favor, preencha o campo Assunto!";
											   setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",3000);
											   formulario_contato.txt_assunto.focus();
											   return false;
									 }
		 
										 if (formulario_contato.txt_mensagem.value == ""){
												   document.getElementById("resposta").innerHTML = "Por favor, preencha o campo Mensagem!";
												   setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",3000);
												   formulario_contato.txt_mensagem.focus();
												   return false;
										 }
	
	return true;
}


////////////////////////////////////////////////////////////////////////////////////
/// FORMULARIO DE CONTATO DO SITE
//////////////////////////////////////////////////////////////////////////////////
function EnviaForma()
{
	var formulario_contato = document.getElementById('Contatos_a');
	
	if (Validaformulario_contatoo())
	{
	    formulario_contato.action = 'Insert_Avaliacao.php';
	    formulario_contato.submit();
		alert("Formulario enviado com sucesso, breve responderemos seu contato.");
	}
}
function Validaformulario_contatoo()
{
	var formulario_contato = document.getElementById('Contatos_a');
	$foo("#resposta").fadeIn("slow");
	
	if (formulario_contato.txt_nome.value == "")
	{
		//alert("O campo Nome é obrigatório para enviar!");
		formulario_contato.txt_nome.focus();
		document.getElementById("resposta").innerHTML = "Por favor, preencha o campo Nome!";
		setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",4000);
		return false;
	}
	
		if (formulario_contato.txt_email.value == ""){
					   document.getElementById("resposta").innerHTML = "Por favor, preencha o campo E-mail!";
					   setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",4000);
					   formulario_contato.txt_email.focus();
					   return false;
			 }
			 //validar email(verificao de endereco eletrônico)
			 parte1 = formulario_contato.txt_email.value.indexOf("@");
			 parte2 = formulario_contato.txt_email.value.indexOf(".");
			 parte3 = formulario_contato.txt_email.value.length;
			 if (!(parte1 >= 3 && parte2 >= 6 && parte3 >= 9)) {
					   document.getElementById("resposta").innerHTML = "Por favor, digite um E-mail válido!";
					   setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",3000);
					   formulario_contato.txt_email.focus();
					   return false;
			 }
		 
				 if (formulario_contato.txt_telefone.value == ""){
							   document.getElementById("resposta").innerHTML = "Por favor, preencha o campo Telefone!";
								setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",3000);
							   formulario_contato.txt_telefone.focus();
							   return false;
					 }
         //validar telefone(verificacao se contem apenas numeros)
						 if (isNaN(formulario_contato.txt_telefone.value)){
								  document.getElementById("resposta").innerHTML = "O campo Telefone deve conter apenas números";
									setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",3000);
								  formulario_contato.txt_telefone.focus();
								   return false;
						 }
						 
							if (formulario_contato.txt_cidade.value == ""){
									   document.getElementById("resposta").innerHTML = "Por favor, preencha o campo Cidade!";
										setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",3000);
									   formulario_contato.txt_cidade.focus();
									   return false;
							 }
		 
								 if (formulario_contato.txt_estado.value == ""){
										   document.getElementById("resposta").innerHTML = "Por favor, preencha o campo Estado!";
										   setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",3000);
										   formulario_contato.txt_estado.focus();
										   return false;
								 }
		 
		  
		
									if (formulario_contato.txt_assunto.value == ""){
											   document.getElementById("resposta").innerHTML = "Por favor, preencha o campo Assunto!";
											   setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",3000);
											   formulario_contato.txt_assunto.focus();
											   return false;
									 }
		 
										 if (formulario_contato.txt_mensagem.value == ""){
												   document.getElementById("resposta").innerHTML = "Por favor, preencha o campo Mensagem!";
												   setTimeout("$foo(\"#resposta\").fadeOut(\"slow\");",3000);
												   formulario_contato.txt_mensagem.focus();
												   return false;
										 }
	
	return true;
}


