// JavaScript Document

//mostras_ocultar divs
function abas(object, tabela) {
	
	document.getElementById('modulo1').style.display = "none";
 	document.getElementById('modulo2').style.display = "none";
	document.getElementById('modulo3').style.display = "none";
	document.getElementById('modulo4').style.display = "none";
 
 tb = document.getElementById(tabela);
 
 if (tb.style.display == "none") {
 
  tb.style.display = "block";
 }
 else {
  tb.style.display = "none";
 }
}

function miniCurriculo(object, tabela) {
 
 tb = document.getElementById(tabela);
 
 if (tb.style.display == "none") {
  tb.style.display = "block";
 }
 else {
  tb.style.display = "none";
 }
}




// validacao form fale conosco
function Form1_Validator(theForm)
	{
	
	  // check to see if the field is blank
	  if (theForm.nome.value == "")
	  {
		alert("O campo \"Nome\" é obrigatório, por favor preencha-o.");
		theForm.nome.focus();
		return (false);
	  }
	
	 // check if email field is blank
	 if (theForm.email.value == "")
	  {
		alert("Por favor preencha o campo \"e-mail\".");
		theForm.email.focus();
		return (false);
	  }
	
	 // test if valid email address, must have @ and .
	  var checkEmail = "@.";
	  var checkStr = theForm.Email.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;
		}
		// if both the @ and . were in the string
		if (EmailAt && EmailPeriod)
		{
			EmailValid = true
			break;
		}
	  }
	  if (!EmailValid)
	  {
		alert("O campo \"E-mail\" é inválido, por favor tente novamente. Ele deve conter uma \"@\" e um \".\".");
		theForm.email.focus();
		return (false);
	  }
	  
	
	  // because this is a sample page, don't allow to exit to the post action
	  // comes in handy when you are testing the form validations and don't
	  // wish to exit the page
	  return (true);
	  // replace the above with return(true); if you have a valid form to submit to
	}


// validacao form cadastro
function Form2_Validator(theForm)
	{
	
	  // check nome
	  if (theForm.nome.value == "")
	  {
		alert("O campo \"Nome\" é obrigatório, por favor preencha-o.");
		theForm.nome.focus();
		return (false);
	  }
	  
	  // telefone
	  if (theForm.telefone.value == "")
	  {
		alert("O campo \"Telefone\" é obrigatório, por favor preencha-o.");
		theForm.telefone.focus();
		return (false);
	  }
	
	 // check email
	 if (theForm.email.value == "")
	  {
		alert("Por favor preencha o campo \"e-mail\".");
		theForm.email.focus();
		return (false);
	  }
	
	 // test if valid email address, must have @ and .
	  var checkEmail = "@.";
	  var checkStr = theForm.Email.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;
		}
		// if both the @ and . were in the string
		if (EmailAt && EmailPeriod)
		{
			EmailValid = true
			break;
		}
	  }
	  if (!EmailValid)
	  {
		alert("O campo \"E-mail\" é inválido, por favor tente novamente. Ele deve conter uma \"@\" e um \".\".");
		theForm.email.focus();
		return (false);
	  }
	
	 
	 	
	
	  // because this is a sample page, don't allow to exit to the post action
	  // comes in handy when you are testing the form validations and don't
	  // wish to exit the page
	  return (true);
	  // replace the above with return(true); if you have a valid form to submit to
	}



