function nome_1()
{
  if (document.cadastro.nome.value == ""){

   document.getElementById('div2').innerHTML = "<img border=0 src=excluir.gif> Digite seu nome"; 

 document.cadastro.nome.style.background = "url(reject.gif) no-repeat right";

}
else {


 document.cadastro.nome.style.background = "url(accept.gif) no-repeat right";

}
}

function email_1()
{
  if (document.cadastro.email.value.length < 7){
document.getElementById('div2').innerHTML = "<img border=0 src=excluir.gif> E-mail inválido"; 


 document.cadastro.email.style.background = "url(reject.gif) no-repeat right";

}
else {
document.getElementById('div2').innerHTML = ""; 


 document.cadastro.email.style.background = "url(accept.gif) no-repeat right";

}
}

function senha_1()
{
  if (document.cadastro.senha.value == "" || document.cadastro.senha.value.length < 4 || document.cadastro.senha.value.length > 20){
document.getElementById('div2').innerHTML = "<img border=0 src=excluir.gif> A senha deve ter no mínimo 4 caracteres e no máximo 20"; 


 document.cadastro.senha.style.background = "url(reject.gif) no-repeat right";

}
else {
document.getElementById('div2').innerHTML = ""; 


 document.cadastro.senha.style.background = "url(accept.gif) no-repeat right";

}
}

function csenha_1()
{
  if (document.cadastro.senha.value != document.cadastro.csenha.value){
                document.getElementById('div2').innerHTML = "<img border=0 src=excluir.gif> Confirma Senha não pode ser diferente da senha!"; 
 document.cadastro.csenha.style.background = "url(reject.gif) no-repeat right";
 document.cadastro.senha.style.background = "url(reject.gif) no-repeat right";
  }
  else {
		document.getElementById('div2').innerHTML = ""; 
 document.cadastro.csenha.style.background = "url(accept.gif) no-repeat right";
 document.cadastro.senha.style.background = "url(accept.gif) no-repeat right";
  }
}

function cidade_1()
{
if (document.cadastro.cidade.value == "") {
                document.getElementById('div2').innerHTML = "<img border=0 src=excluir.gif> Digite uma cidade"; 
 document.cadastro.cidade.style.background = "url(reject.gif) no-repeat right";
}
else {
		document.getElementById('div2').innerHTML = ""; 
 document.cadastro.cidade.style.background = "url(accept.gif) no-repeat right";
}
}

function estado_1()
{
if (document.cadastro.estado.value == "") {
                document.getElementById('div2').innerHTML = "<img border=0 src=excluir.gif> Digite um estado"; 
 document.cadastro.estado.style.background = "url(reject.gif) no-repeat right";
}
else {
		document.getElementById('div2').innerHTML = ""; 
 document.estado.nome.style.background = "url(accept.gif) no-repeat right";
}
}

function Valida() {

if (document.cadastro.meuCheck.checked == false){  
    alert("É necessario ter mais de 18 anos, se responsabilizar em não postar conteudo erótico e aceito os termos de uso");
    return false;
    }


  if (document.cadastro.userr.value == ""){
  		alert("Digite o usuário");
  		document.cadastro.userr.style.background = "#FFAAAA"
      return false;
  }

  if (document.cadastro.senha.value == ""){
  		alert("Digite uma senha");
  		document.cadastro.senha.style.background = "#FFAAAA"
      return false;
  }

  if (document.cadastro.csenha.value == ""){
  		alert("Digite a confirmação de sua senha");
  		document.cadastro.csenha.style.background = "#FFAAAA"
      return false;
  }

  if (document.cadastro.email.value == ""){
  		alert("Digite seu email");
  		document.cadastro.email.style.background = "#FFAAAA"
      return false;
  }

  if (document.cadastro.nome.value == ""){
  		alert("Digite seu nome");
  		document.cadastro.nome.style.background = "#FFAAAA"
      return false;
  }

  if (document.cadastro.cidade.value == ""){
  		alert("Digite sua cidade");
  		document.cadastro.cidade.style.background = "#FFAAAA"
      return false;
  }

  if (document.cadastro.estado.value == ""){
  		alert("Digite seu estado");
  		document.cadastro.estado.style.background = "#FFAAAA"
      return false;
  }

  if (document.cadastro.senha.value != document.cadastro.csenha.value){
		alert("Senha e confirma senha não podem ser diferentes");
  		document.cadastro.senha.style.background = "#FFAAAA"
  		document.cadastro.csenha.style.background = "#FFAAAA"
		document.cadastro.senha.value = "" 
		document.cadastro.csenha.value = "" 
      return false;
  }

  if (document.cadastro.senha.value == document.cadastro.userr.value){
  		alert("Senha deve ser diferente do login");
  		document.cadastro.senha.style.background = "#FFAAAA"
      return false;
  }

  if (document.cadastro.userr.value.length < 2 || document.cadastro.userr.value.length > 20){
		alert("Usuário deve ter entre 2 e 20 caracteres");
  		document.cadastro.userr.style.background = "#FFAAAA"
      return false;
  }

  if (document.cadastro.senha.value.length < 4 || document.cadastro.senha.value.length > 20){
		alert("Senha deve ter entre 4 e 20 caracteres");
  		document.cadastro.senha.style.background = "#FFAAAA"
  		document.cadastro.csenha.style.background = "#FFAAAA"
      return false;
  }

  if (document.cadastro.email.value.length < 7){
		alert("Email inválido");
  		document.cadastro.email.style.background = "#FFAAAA"
      return false;
  }

  return true;
}
