function ampliar(foto)
{
    document.getElementById("imagem").src = "imagens/"+foto
}

function toggleContent(strDivName)
{
    if (eval (document.getElementById(strDivName)).style.display != 'block')
    {
        eval (document.getElementById(strDivName)).style.display = 'block';
    }
    else
    {
        eval (document.getElementById(strDivName)).style.display = 'none';
    }
}

function validarContato()
{
	msgErros = '';
	cntErros = 0;
	with (document.formContato)
	{
		if (Nome.value.length < 3)
		{
			msgErros += "-> Nome\n";
			cntErros++;
		}

		
		
		if (Email.value.length < 6)
		{
			msgErros += "-> Email\n";
			cntErros++;
		}
		else
		{
			if (Email.value.indexOf('@',0)==-1 ||
				Email.value.indexOf('@',0)== 0 ||
				Email.value.indexOf('.',0)==-1)
      	{
            msgErros += "-> Email (é inválido)\n";
				cntErros++;
      	}
		}
		
		if (Assunto.value.length < 3)
		{
			msgErros += "-> Assunto\n";
			cntErros++;
		}
		
		if (Mensagem.value.length < 5)
		{
			msgErros += "-> Mensagem\n";
			cntErros++;
		}
	
		if (cntErros > 0)
		{
			alert("Você precisa preencher corretamente o(s) campo(s)\n abaixo para poder enviar o formulário:\n" + msgErros);
		}
		else
		{
			if (confirm("Você confirma as informações contidas no formulário?"))
			{
				action = "envia_mail.php";
				submit();
			}
		}
	}

}

//AJAX

var xmlhttp;
function loadXMLDoc(url)
{
xmlhttp=null;
if (window.XMLHttpRequest)
  {// code for Firefox, Opera, IE7, etc.
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=state_Change;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
  }
else
  {
  alert("A versão de seu navegador é antiga e não suporta XMLHTTP.");
  }
}

function state_Change()
{
if (xmlhttp.readyState==4)
  {// 4 = "loaded"
  if (xmlhttp.status==200)
    {// 200 = "OK"
    document.getElementById('servicos').innerHTML=xmlhttp.responseText;
    }
  else
    {
    //alert("Problema ao carregar dados: " + xmlhttp.statusText);
    document.getElementById('servicos').innerHTML="<strong>ERRO! Problema ao carregar dados: </strong>" + xmlhttp.statusText;
    }
  }
}

// fim ajax


