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();
			}
		}
	}

}


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

		if (endereco.value.length < 6)
		{
			msgErros += "-> Endereço\n";
			cntErros++;
		}
		
		if (numero.value.length < 1)
		{
			msgErros += "-> Número\n";
			cntErros++;
		}
		
		if (bairro.value.length < 3)
		{
			msgErros += "-> Bairro\n";
			cntErros++;
		}
		
		if (cidade.value.length < 3)
		{
			msgErros += "-> Cidade\n";
			cntErros++;
		}
		
		if (uf.value.length < 2)
		{
			msgErros += "-> UF\n";
			cntErros++;
		}
		
		if (pais.value.length < 3)
		{
			msgErros += "-> País\n";
			cntErros++;
		}
		
		if (telefones.value.length < 7)
		{
			msgErros += "-> Telefones\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 (senha.value.length < 6)
		{
			msgErros += "-> Senha\n";
			cntErros++;
		}
		else
		{
			if ((senha.value) != (senha1.value))
			{
				msgErros += "-> As senhas não estão iguais\n";	
				cntErros++;
			}
		}
		
		if (objetivoProfisional.value.length < 5)
		{
			msgErros += "-> Objetivo Profissional\n";
			cntErros++;
		}
		
		if ((serieEM.value.length < 1) && (cursoGR.value.length < 1) && (cursoPGR.value.length < 1))
		{
			msgErros += "-> Informe sua escolaridade\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 = "cadastra_curriculo.php";
				submit();
			}
		}
	}

}


function favoritos()
{
	URL = "http://www.unicarreira.com.br"
	Titulo = "UNICARREIRA"
	window.external.AddFavorite(URL,Titulo);	   
}	



//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

