// CHECAGEM DOS CAMPOS
function checa_cadastro(form_cadastro){
if (form_cadastro.nome.value == ""){
alert("O campo [Nome] é de preenchimento obrigatório");
document.form_cadastro.nome.style.background="#063c7a";
form_cadastro.nome.focus();
return (false);
}
if (form_cadastro.email.value == ""){
alert("O campo [E-mail] é de preenchimento obrigatório");
document.form_cadastro.email.style.background="#063c7a";
form_cadastro.email.focus();
return (false);
}
if (form_cadastro.apelido.value == ""){
alert("O campo [Apelido] é de preenchimento obrigatório");
document.form_cadastro.apelido.style.background="#063c7a";
form_cadastro.apelido.focus();
return (false);
}
if (form_cadastro.endereco.value == ""){
alert("O campo [Endereço] é de preenchimento obrigatório");
document.form_cadastro.endereco.style.background="#063c7a";
form_cadastro.endereco.focus();
return (false);
}
if (form_cadastro.bairro.value == ""){
alert("O campo [Bairro] é de preenchimento obrigatório");
document.form_cadastro.bairro.style.background="#063c7a";
form_cadastro.bairro.focus();
return (false);
}
if (form_cadastro.estado.value == 0){
alert("O campo [Estado] é de preenchimento obrigatório");
document.form_cadastro.estado.style.background="#063c7a";
form_cadastro.estado.focus();
return (false);
}
if (form_cadastro.senha.value == ""){
alert("O campo [Senha] é de preenchimento obrigatório");
document.form_cadastro.senha.style.background="#063c7a";
form_cadastro.senha.focus();
return (false);
}
if (form_cadastro.confirma_senha.value == ""){
alert("Por favor, confirme a senha.");
document.form_cadastro.confirma_senha.style.background="#063c7a";
form_cadastro.confirma_senha.focus();
return (false);
}
return (true);
}
//===================================================================================================================
// VALIDAÇÕES
//===================================================================================================================
function VerificaSenha() // Cria a Função para comparar 2 valores
{ 
document.all.msg1.innerHTML = '&nbsp;'; 
if (document.form_cadastro.senha.value != document.form_cadastro.confirma_senha.value)  // Aqui faz a comparação se a senha 1 confere com a senha2 
{ 
document.all.msg1.innerHTML = '&nbsp;&nbsp;<img src=imagens/erro.png> <b><font class="conteudo_noticia">Senha não confere.</font></b>';  // Exibo a imagem de errado
return false;
}
return true; 
} 
//===================================================================================================================
// MASCARAS
//===================================================================================================================
function formata(campo, mask, evt) {

//O caracter '?' define que só será permitido números
//O caracter '!' define que é permitido qualquer caracter
//onkeypress="return formata(this, '???.???.???-??', Event)"

 if(document.all) { // Internet Explorer
    key = evt.keyCode; }
    else{ // Nestcape
       key = evt.which;
     }

if (key == 8) {
return true;
}

 string = campo.value;  
 i = string.length;

 if (i < mask.length) {
  if (mask.charAt(i) == '?') {
       return (key > 47 && key < 58);
      } else {
       if (mask.charAt(i) == '!') {  return true;  }
   for (c = i; c < mask.length; c++) {
         if (mask.charAt(c) != '?' && mask.charAt(c) != '!')
		 campo.value = campo.value + mask.charAt(c)
		 //if (campo.value != "") {campo.value = campo.value + mask.charAt(c)}else{campo.value = mask.charAt(0)};
      else if (mask.charAt(c) == '!'){
                return true;
       } else {
         return (key > 47 && key < 58);
          }
       }
    }
  } else return false;
}

// CONFIRMAR
function confirmar() { 

 if (confirm("Tem certeza que deseja realizar esta ação?")) { 
return true; 
 } else { 
return false; 
 } 
} 

// AUMENTAR TEXTO
var tgs = new Array( 'div' );

var szs = new Array( 'conteudo_noticia_1','conteudo_noticia_2','conteudo_noticia_3','conteudo_noticia_4','conteudo_noticia_5' );
var startSz = 2;

function EditaLetra( trgt,inc ) {
if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;
sz += inc;
if ( sz < 0 ) sz = 0;
if ( sz > 4 ) sz = 4;
startSz = sz;
if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

cEl.className = szs[ sz ];

for ( i = 0; i < tgs.length; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0; j < cTags.length; j++ ) cTags[ j ].className = szs[ sz ];
}
}
