// JavaScript Document

function ajax()
{
	var xmlhttp;
	if (window.XMLHttpRequest) 
  		{	xmlhttp=new XMLHttpRequest();	}
	else if (window.ActiveXObject)
  		{	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");	}
	else
		{	alert("Seu navegador não dá suporte à AJAX!");	}

	return xmlhttp;
}


function criaTabela(arquivo, local)
{	
	var xmlhttp = ajax();
	xmlhttp.onreadystatechange=function()
	{	
		if(xmlhttp.readyState < 4) 
			{ 
			//var carregando = "<p align='center'><img src='img/carregando.gif' /></p>";
			//document.getElementById("carregando").innerHTML= carregando;
			}			
		else if(xmlhttp.readyState==4)
	  		{
				if(xmlhttp.status==200){
					document.getElementById(local).innerHTML= xmlhttp.responseText;
				} else {
					alert(xmlhttp.responseText);
				}
			}
	}
	
	xmlhttp.open("POST",arquivo,true);
	xmlhttp.send(null);
}


var jaclicou=0;
function valida_contato()
{
  <!--
	if (document.form_contato.nome.value == '' )
	{
		alert("Digite o seu nome");
		document.form_contato.nome.focus();
		return false 
	}

	if (document.form_contato.email.value.indexOf('@', 0) == -1 || document.form_contato.email.value.indexOf('.', 0) == -1)
	{
		alert("E-mail invalido!");
		document.form_contato.email.focus();
		return false 
	}

	if (document.form_contato.msg.value == '' )
	{
		alert("Digite sua mensagem");
		document.form_contato.msg.focus();
		return false 
	}

	if (jaclicou==0) {
		jaclicou=1;
		document.form_contato.submit();
	} else {
		alert ("Sua solicitação está sendo processada.\nAguarde!");
		document.form_contato.nome.focus();
		return false 
	}

}

var jaclicou=0;
function valida_trabalhe()
{
  <!--
	if (document.form_trabalhe.nome.value == '' )
	{
		alert("Digite o seu nome");
		document.form_trabalhe.nome.focus();
		return false 
	}

	if (document.form_trabalhe.email.value.indexOf('@', 0) == -1 || document.form_trabalhe.email.value.indexOf('.', 0) == -1)
	{
		alert("E-mail invalido!");
		document.form_trabalhe.email.focus();
		return false 
	}

	if (document.form_trabalhe.msg.value == '' )
	{
		alert("Digite sua mensagem");
		document.form_trabalhe.msg.focus();
		return false 
	}

	if (jaclicou==0) {
		jaclicou=1;
		document.form_trabalhe.submit();
	} else {
		alert ("Sua solicitação está sendo processada.\nAguarde!");
		document.form_trabalhe.nome.focus();
		return false 
	}

}

