// JavaScript Document
// criado por Vicente Eugenio
// para o site Jornal do interior
// vicente.eugenio@hotmail.com



// --------------------------------
// mostrar divs

function mostrar(id1,id2)
	{
	document.getElementById(id1).style.display = "";
	if (id2 != '') 
		{
		document.getElementById(id2).style.display = "";
		}
	}
function ocultar(id1,id2)
	{
	document.getElementById(id1).style.display = "none";
		if (id2 != '') 
		{
		document.getElementById(id2).style.display = "none";
		}
	}

// cidades ocultas....
cidadesDisplay = true;
function cidadesOcultas() 
{
	if (cidadesDisplay)
	{
		mostrar('cidadesEscondidas','');
		cidadesDisplay = false;
	}
	else
	{
		ocultar('cidadesEscondidas','');
		cidadesDisplay = true;
	}
}

// --------------------------------
// fim mostrar divs



// --------------------------------
// mudar imagem

function mudarImagem(id, imagem) {
	document.getElementById(id).src = imagem;	
}

// --------------------------------
// abre janela
function abreJanela(largura, altura, pagina, opcoes) {
	var janela = window.open(pagina,'janela','top='+(screen.height - altura) / 2+', left='+(screen.width - largura) / 2+', width='+largura+', height='+altura + opcoes);
	//alert (janela);
	janela.focus();
}

// --------------------------------
// funcao impressao
function imprimir() {
	if ( window.print ) {
		window.print();
	}
}

<!--
function Verifica_CPF(formulario) {
	// verificando a senha
	if (formulario.nome.value == '') {
		alert('Valor inválido');
      	formulario.nome.value = '';
      	formulario.nome.focus();
      	return false;
	}
	if (formulario.email.value == '' || formulario.email.value.search('@') < 1) {
		alert('Valor inválido');
      	formulario.email.value = '';
      	formulario.email.focus();
      	return false;
	}
	if (formulario.senha.value != formulario.senha2.value || formulario.senha.value == '') {
		alert('Senha não confere com a confirmação ou a senha está em branco');
      	formulario.senha.value = '';
		formulario.senha2.value = '';
      	formulario.senha.focus();
      	return false;
		
	}
	
	
var CPF = formulario.CPF.value; // Recebe o valor digitado no campo

// Verifica se o campo é nulo
if (CPF == '') {
  alert('Este campo é de preenchimento obrigatório!');
  formulario.CPF.focus();
  return false;
   }

// Aqui começa a checagem do CPF
var POSICAO, I, SOMA, DV, DV_INFORMADO;
var DIGITO = new Array(10);
DV_INFORMADO = CPF.substr(9, 2); // Retira os dois últimos dígitos do número informado

// Desemembra o número do CPF na array DIGITO
for (I=0; I<=8; I++) {
  DIGITO[I] = CPF.substr( I, 1);
}

// Calcula o valor do 10º dígito da verificação
POSICAO = 10;
SOMA = 0;
   for (I=0; I<=8; I++) {
      SOMA = SOMA + DIGITO[I] * POSICAO;
      POSICAO = POSICAO - 1;
   }
DIGITO[9] = SOMA % 11;
   if (DIGITO[9] < 2) {
        DIGITO[9] = 0;
}
   else{
       DIGITO[9] = 11 - DIGITO[9];
}

// Calcula o valor do 11º dígito da verificação
POSICAO = 11;
SOMA = 0;
   for (I=0; I<=9; I++) {
      SOMA = SOMA + DIGITO[I] * POSICAO;
      POSICAO = POSICAO - 1;
   }
DIGITO[10] = SOMA % 11;
   if (DIGITO[10] < 2) {
        DIGITO[10] = 0;
   }
   else {
        DIGITO[10] = 11 - DIGITO[10];
   }

// Verifica se os valores dos dígitos verificadores conferem
DV = DIGITO[9] * 10 + DIGITO[10];
   if (DV != DV_INFORMADO) {
      alert('CPF inválido');
      formulario.CPF.value = '';
      formulario.CPF.focus();
      return false;
   }
}
