function posicionaLogo()
{
  winX = screen.width;
  if (winX <= 800){ 
  positionX = 0; 
  } 
  else if (winX >= 1024 && winX < 1280){ 
	positionX = 52; //antes 92 mudança logo 10 anos
  } 
  else if (winX >= 1280 && winX < 1300){ 
	positionX = 148; //antes 188 mudança logo 10 anos
  } 
  else 
  { 
    positionX = 148 + ((winX - 1280)/2);//antes 188 mudança logo 10 anos
  }	
    document.getElementById('logo_principal').style.left = positionX + 'px';
}
function posicionaTopoEsquerda() //bug IE7 e anteriores
{
  if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
    var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
    if (ieversion<8)
    {
      winW = document.body.clientWidth;
      winH = document.body.clientWidth;
	  margem_esquerda = 0; //somente a barra de rolagem
      tamanho_topo_direita = (winW/2);
      document.getElementById('topo_direita').style.width = tamanho_topo_direita + 'px';
    }
  }
}

function O_gnCPF () 
{
  cpf = document.form.cpf1.value;
  cpf += document.form.cpf2.value;
  cpf += document.form.cpf3.value;
  cpf += document.form.cpf4.value;
  var a = [];
  var b = new Number;
  var c = 11;

  erro = new String;
  if (cpf.length != 11 && cpf.length != 0 ) 
    erro = "CPF inválido"; 


  var nonNumbers = /\D/;

  if (nonNumbers.test(cpf)) 
    erro = "Digite apenas números"; 

  if (cpf == "00000000000" || cpf == "11111111111" || cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" || cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" || cpf == "88888888888" || cpf == "99999999999" )
  {
    erro = "CPF inválido"
  }

  for (i=0; i<11; i++)
  {
    a[i] = cpf.charAt(i);

    if (i < 9) 
      b += (a[i] * --c);
  }

  if ((x = b % 11) < 2) 
  { 
    a[9] = 0; 
  } 
  else
  { 
    a[9] = 11-x; 
  }
   b = 0;
  c = 11;
   for ( y=0; y<10; y++ ) 
    b += (a[y] * c--); 
   if ( (x = b % 11) < 2) 
  { 
    a[10] = 0; 
  } 
  else 
  { 
    a[10] = 11-x;
  }
 
  if ( ( (cpf.charAt(9) != a[9]) || (cpf.charAt(10) != a[10]) ) && cpf.lenght != 0)
  {
    erro ="CPF inválido";
  }
   if (erro.length > 0)
  {
    alert(erro);
    obj_input.value = "";
    ret = false;
  }
  else 
  {
    ret = true;
  }

   return ret;

}

function autoTAB(p_Objeto,p_Num_Casa){
  if ( p_Num_Casa  == undefined )  p_Num_Casa  = p_Objeto.maxLength;
  if (p_Objeto.value.length==p_Num_Casa)
  {
    for(i=0;i<p_Objeto.form.length;i++)
	{
	  if(p_Objeto == p_Objeto.form.elements[i])
	  {
	    p_Objeto_Prox = i;
	  }
	}
	p_Objeto_Prox = p_Objeto_Prox + 1;
	if(p_Objeto_Prox < p_Objeto.form.length)
	{
	  if (p_Objeto.form.elements[p_Objeto_Prox].disabled == true) p_Objeto_Prox = p_Objeto_Prox + 1;
	  p_Objeto.form.elements[p_Objeto_Prox].select();
	  p_Objeto.form.elements[p_Objeto_Prox].focus();
	}
  }
}

function validateContato()
{
  var digits="0123456789";
  var temp="";
  if (document.aleatorio.nome.value.length < 4) 
  {
    alert("Por favor, digite o seu nome!");
    return false;
  }
  if (document.aleatorio.email.value.length < 4) 
  {
    alert("Por favor, digite o seu email!");
    return false;
  }
  if (document.aleatorio.telefone1.value.length < 4 && document.aleatorio.telefone2.value.length < 4) 
  {
  alert("Por favor, digite o número do seu telefone!");
  return false;
  }
  if (document.aleatorio.assunto.value.length < 4) 
  {
    alert("Por favor, digite o assunto!");
    return false;
  }
  if (document.aleatorio.mensagem.value.length < 10) 
  {
    alert("Por favor, digite o sua mensagem!");
    return false;
  }
  return true;
}  
	  

function validateVagas()
{
  var digits="0123456789";
  var temp="";
  if (document.aleatorio.titulo.value.length < 4) 
  {
    alert("Por favor, digite o Título!");
    return false;
  }
  if (document.aleatorio.quantidade.value.length < 1) 
  {
    alert("Por favor, digite a quantidade de vagas!");
    return false;
  }
  if (document.aleatorio.localidade.value.length < 4) 
  {
  alert("Por favor, digite a localidade");
  return false;
  }
  if (document.aleatorio.contato.value.length < 4) 
  {
    alert("Por favor, digite o contato!");
    return false;
  }
  if (document.aleatorio.telefone.value.length < 8) 
  {
    alert("Por favor, digite o seu telefone!");
    return false;
  }
  if (document.aleatorio.email.value.length < 4) 
  {
    alert("Por favor, digite o email!");
    return false;
  }
  if (document.aleatorio.descricao.value.length < 4) 
  {
    alert("Por favor, digite a descricao!");
    return false;
  }
  return true;
}  
	 
	  
function validateMatricula()
{
  var digits="0123456789";
  var temp="";
  if (document.form.nome.value=="") 
  {
    alert("Por favor, digite o seu nome!");
    return false;
  }
  if (document.form.email.value=="") 
  {
    alert("Por favor, digite o seu email!");
    return false;
  }
  if (document.form.logradouro.value=="") 
  {
    alert("Por favor, digite o endereço!");
    return false;
  }
  if (document.form.numero.value=="") 
  {
    alert("Por favor, digite o número de sua casa!");
    return false;
  }
    if (document.form.cidade.value=="") 
  {
    alert("Por favor, digite a sua cidade!");
    return false;
  }
    if (document.form.bairro.value=="") 
  {
    alert("Por favor, digite o seu bairro!");
    return false;
  }
    if (document.form.cep1.value=="" || document.form.cep2.value=="") 
  {
    alert("Por favor, digite o seu cep!");
    return false;
  }
  var b_CPF = O_gnCPF();
  if(b_CPF == false)
  {
    return false;
  }
  
  
  alert('Informamos que sua vaga só estará garantida, mediante o pagamento da matrícula.');
  return true;
}  

function validateCongresso()
{
   var digits="0123456789";
  var temp="";
  if (document.aleatorio.nome.value.length < 4) 
  {
    alert("Por favor, digite o seu nome!");
    return false;
  }
  if (document.aleatorio.email.value.length < 4) 
  {
    alert("Por favor, digite o seu email!");
    return false;
  }
  if (document.aleatorio.telefone1.value.length < 4 && document.aleatorio.telefone2.value.length < 4) 
  {
  alert("Por favor, digite o número do seu telefone!");
  return false;
  }
  if (document.aleatorio.assunto.value.length < 4) 
  {
    alert("Por favor, digite o assunto!");
    return false;
  }
  
  return true;
}  
