var sVersao	= navigator.appVersion;
var bIsIE = ( (sVersao.indexOf("IE") > -1) || (sVersao.indexOf("Mac") > -1) ) ;
var zoom = 100;

  
function in_array(valor,tal_da_array){
			var retorno = false;
			for(var i=0;i<tal_da_array.length;i++){
				if(tal_da_array[i] == valor){
					retorno = true;
				}
			}
			return retorno;
}

function get(elemento){
			if ( bIsIE || navigator.vendor != 'Firefox' ){
				return document.all[elemento];
			} else {
				return document.getElementById(elemento);
			}

}

// Contador de caracteres
function contarIdade1(){
			 var total=2;
			 var digitado=busca.idade1.value.length;
			 if(digitado>total){
			  alert('Número máximo de caracteres excedido.');
			  busca.idade1.value=busca.idade1.value.slice(0,total) //exibe os 2 primeiros caracteres
			 }
			 digitado=busca.idade1.value.length;
			 var restante=total-digitado;
}

function contarIdade2(){
			 var total=2;
			 var digitado=busca.idade2.value.length;
			 if(digitado>total){
			  alert('Número máximo de caracteres excedido.');
			  busca.idade2.value=busca.idade2.value.slice(0,total) //exibe os 2 primeiros caracteres
			 }
			 digitado=busca.idade2.value.length;
			 var restante=total-digitado;
}

function xpalavra() { 

			if (document.busca.tipo.value == "") { 
			alert("Para poder buscar por alguma palavra é necessário que você selecione um filtro");
			busca.tipo.focus();
			busca.tipo.style.backgroundColor = "#fffccc";
			return false;
			} 
}

function valida_palavra() { 
			if (document.busca.tipo.value !== ""){
			
			document.busca.palavra.disabled = false;
			busca.palavra.focus();
			busca.palavra.style.backgroundColor = "#fffccc";
			
			} else { 
			
			document.busca.palavra.disabled = true;
			busca.palavra.style.backgroundColor = "#ffffff";
			}
}

// Validação de Comentários
function valida_comentario() { 

			if (comentarios.nome.value == ""){
			alert("Digite um nome"); 
			comentarios.nome.focus();
			comentarios.nome.style.backgroundColor = "#fffccc";
			return false;
			}
			
			if (comentarios.nome.value.length > 40){
			alert("Nome muito grande, máximo permitido = 40");
			comentarios.nome.focus();
			comentarios.nome.style.backgroundColor = "#fffccc";
			return false;
			}
			
			if (comentarios.texto.value == ""){
			alert("Digite um comentário!"); 
			comentarios.texto.focus();
			comentarios.texto.style.backgroundColor = "#fffccc";
			return false;
			}
			
			if (comentarios.texto.value.length > 1024){
			alert("Comentário muito grande, máximo de caracteres permitidos: 1024");
			comentarios.texto.focus();
			comentarios.texto.style.backgroundColor = "#fffccc";
			return false;
			}
			
			document.comentarios.enviar.disabled = true;
			document.comentarios.enviar.value = "Enviando comentário..."; 
			window.status = 'Enviando comentário..';

}

// Valida comment. se o user. estiver logado
function valida_comentariox() { 

			if (comentarios.texto.value == ""){
			alert("Digite um comentário"); 
			editor.focus();
			return false;
			}
			
			if (comentarios.texto.value.length > 4096){
			alert("Comentário muito grande, máximo de caracteres permitidos: 2048");
			editor.focus();
			return false;
			}
			
			document.comentarios.enviar.disabled = true;
			document.comentarios.enviar.value = "Enviando comentário.."; 
			window.status = 'Enviando comentário..';

}


// Validação de BUSCA

function valida_busca() { // FIRST
			
			if (document.busca.categoria.value == "" && document.busca.tipo.value == "" && document.busca.palavra.value == "" && document.busca.sexo.value == "" && document.busca.idade1.value == "") { 
			
			alert("É necessário que você informe algum critério para efetuar sua busca!");
			return false;
			
			}
			
			if (document.busca.tipo.value !== "" && document.busca.palavra.value == ""){ // 1
			
			alert("Como você selecionou um filtro para sua busca, é necessário especificar uma palavra chave!");
			busca.palavra.focus();
			busca.palavra.style.backgroundColor = "#fffccc";
			return false;
			
			} 
			
			if (document.busca.idade1.value !== "" && document.busca.idade2.value == ""){ // CHAVE PRIMÁRIA (1) 
			
			alert("Preencha o campo da idade secundária!");
			busca.idade2.focus();
			busca.idade2.style.backgroundColor = "#fffccc";
			return false;
			
			}
			
			if (document.busca.idade1.value !== "" && busca.idade1.value > busca.idade2.value && busca.idade1.value.lenght > busca.idade2.value.lenght) {  // Chave primária (2)
			
			alert("A primeira idade não pode ser maior que a segunda!");
			busca.idade1.focus();
			busca.idade1.style.backgroundColor = "#fffccc";
			return false;
			
			
			} 
			
			var sInter = document.busca.idade2.value-document.busca.idade1.value;
			
			if (sInter > 10) { 
			
			alert("O intervalo da idade não deve ser superior a 10 anos");
			return false;
			
			}
			
			document.busca.submit(); // Submete o formulário
			document.busca.buscar.disabled = true; // Desabilita o botão buscar
			document.busca.buscar.value = "Buscando...";  // Muda a propriedade do botão
			window.status = 'Buscando usuários..'; // Exibe mensagem na barra de status

} // MATOU TUDO


function valida_buxca() { // FIRST
			
			if (document.busca.categoria.value == "" && document.busca.tipo.value == "" && document.busca.palavra.value == "" && document.busca.sexo.value == "" && document.busca.idade1.value == "") { 
			
			alert("É necessário que você informe algum critério para efetuar sua busca!");
			return false;
			
			}
			
			if (document.busca.tipo.value !== "" && document.busca.palavra.value == ""){ // 1
			
			alert("Como você selecionou um filtro para sua busca, é necessário especificar uma palavra chave!");
			busca.palavra.focus();
			busca.palavra.style.backgroundColor = "#fffccc";
			return false;
			
			} 
			
			if (document.busca.idade1.value !== "" && document.busca.idade2.value == ""){ // CHAVE PRIMÁRIA (1) 
			
			alert("Preencha o campo da idade secundária!");
			busca.idade2.focus();
			busca.idade2.style.backgroundColor = "#fffccc";
			return false;
			
			}
			
			if (document.busca.idade1.value !== "" && busca.idade1.value > busca.idade2.value && busca.idade1.value.lenght > busca.idade2.value.lenght) {  // Chave primária (2)
			
			alert("A primeira idade não pode ser maior que a segunda!");
			busca.idade1.focus();
			busca.idade1.style.backgroundColor = "#fffccc";
			return false;
			
			
			} 
			
			var sInter = document.busca.idade2.value-document.busca.idade1.value;
			
			if (sInter > 10) { 
			
			alert("O intervalo da idade não deve ser superior a 10 anos");
			return false;
			
			}
			
			document.busca.submit(); // Submete o formulário
			window.status = 'Buscando usuários..'; // Exibe mensagem na barra de status

}

// Validação de perca de senha
// Inicio da função
function valida_recupera() { 
			if (document.perdeu.user.value==""){
			alert("O preenchimento do usuário (login) é obrigatório"); 
			document.perdeu.user.focus()
			perdeu.user.style.backgroundColor = "#fffccc";
			return false;
			}
			if (perdeu.user.value.length < 3){
			alert("Seu login deve conter no mínimo 3 caracteres e no máximo 20!")
			perdeu.user.focus();
			perdeu.user.style.backgroundColor = "#fffccc";
			return false;
			}
			if (perdeu.user.value.length > 20){
			alert("Seu login deve conter no mínimo 3 caracteres e no máximo 20!")
			perdeu.user.focus();
			perdeu.user.style.backgroundColor = "#fffccc";
			return false;
			}
			if (document.perdeu.email.value==""){
			alert("O preenchimento do e-mail é obrigatório"); 
			document.perdeu.email.focus()
			perdeu.email.style.backgroundColor = "#fffccc";
			return false;
			}
			if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(perdeu.email.value)))
			{
			alert("Digite o e-mail corretamente.")
			document.perdeu.email.focus()
			perdeu.email.style.backgroundColor = "#fffccc";
			return false;
			}
			document.perdeu.submit();
}

// Validação de mudança de senha
function valida_muda() { 
			
			if (document.muda_senha.senha.value == ""){
				
			alert("O preenchimento da senha atual é obrigatório"); 
			document.muda_senha.senha.focus()
			muda_senha.senha.style.backgroundColor = "#fffccc";
			return false;
			}
			
			if (document.muda_senha.nova_senha.value == ""){
			alert("O preenchimento da nova senha é obrigatório"); 
			document.muda_senha.nova_senha.focus()
			muda_senha.nova_senha.style.backgroundColor = "#fffccc";
			return false;
			}
			
			if (muda_senha.senha.value.length < 6) {
			alert("Sua senha deve conter no mínimo 6 caracteres!");
			muda_senha.senha.focus()
			muda_senha.senha.style.backgroundColor = "#fffccc";
			return false;
			}
			
			if (muda_senha.nova_senha.value.length < 6) {
			alert("Sua nova senha deve conter no mínimo 6 caracteres!");
			muda_senha.nova_senha.focus()
			muda_senha.nova_senha.style.backgroundColor = "#fffccc";
			return false;
			
			}
			document.muda_senha.submit();
}

// END OF 
// Validação de links
// Inicio da função

function valida_links() { 
			if (document.cad_links.site1.value==""){
			alert("O preenchimento do nome do site é obrigatório"); 
			document.cad_links.site1.focus()
			cad_links.site1.style.backgroundColor = "#fffccc";
			return false;
			}
			if (document.cad_links.desc1.value==""){
			alert("A descrição é obrigatória"); 
			document.cad_links.desc1.focus()
			cad_links.desc1.style.backgroundColor = "#fffccc";
			return false;
			}
			if (document.cad_links.url1.value==""){
			alert("A URL é obrigatória"); 
			document.cad_links.url1.focus()
			cad_links.url1.style.backgroundColor = "#fffccc";
			return false;
			}
			document.cad_links.cadastrar.disabled = true;
			document.cad_links.cadastrar.value = "Inserindo links.."; 
			window.status = 'Inserindo links...';
			document.cad_links.submit();
}

// Validação de senha
// Inicio da função

function troca_senha() { 
			if (document.troca.senha.value==""){
			alert("O preenchimento da senha é obrigatório"); 
			document.troca.senha.focus();
			troca.senha.style.backgroundColor = "#fffccc";
			return false;
			}
			if (document.troca.nova_senha.value==""){
			alert("O preenchimento da nova senha é obrigatório"); 
			document.troca.nova_senha.focus();
			troca.nova_senha.style.backgroundColor = "#fffccc";
			return false;
			}
			if (troca.nova_senha.value.length < 6){
			alert("A nova senha deve ter no mínimo 6 caracteres!")
			troca.nova_senha.style.backgroundColor = "#fffccc";
			troca.nova_senha.focus();
			return (false);
			}
			if (troca.nova_senha.value.length > 15){
			alert("Senha muito grande, escolha uma menor!")
			troca.nova_senha.style.backgroundColor = "#fffccc";
			troca.nova_senha.focus();
			return (false);
			}
			document.troca.submit();
}

// Validação de upload
// Inicio da função
// Descrição
function valida_upload() { 
			
			if (document.upload.foto.value==""){
			alert("Selecione uma foto!\n\n Clique em Procurar"); 
			document.upload.foto.focus()
			upload.foto.style.backgroundColor = "#fffccc";
			document.upload.enviar.disabled = false;
			return false;
			}
			
			var ext_permitidas = new Array('jpg','jpeg','gif','png');
			var extensao = document.upload.foto.value.substr(document.upload.foto.value.length - 3).toLowerCase();
			
			if(!in_array(extensao,ext_permitidas)){
			alert("Você está tentando mandar um arquivo de extensão ."+extensao+".\nFormatos de fotos aceitos: JPG, JPEG, GIF e PNG\n");
			document.upload.foto.focus()
			upload.foto.style.backgroundColor = "#fffccc";
			document.upload.enviar.disabled = false;
			return false;
			}
			
			if(document.upload.foto.fileSize > 1024){
			alert("- Tamanho da foto é maior que o permitido (1 MB).");
			document.upload.foto.focus()
			upload.foto.style.backgroundColor = "#fffccc";
			document.upload.enviar.disabled = false;
			return false;
			}
			
			
			if (document.upload.descricao.value==""){
			alert("Digite uma descrição"); 
			document.upload.descricao.focus()
			upload.descricao.style.backgroundColor = "#fffccc";
			document.upload.enviar.disabled = false;
			return false;
			}
			if (document.upload.texto.value==""){
			alert("Digite um texto"); 
			document.upload.texto.focus()
			upload.texto.style.backgroundColor = "#fffccc";
			document.upload.enviar.disabled = false;
			return false;
			}
			
			// Validação de upload
			// Post - Número de caracteres
			
			if (upload.texto.value.length > 1024){
			alert("Texto muito grande, máximo de caracteres permitidos: 1024")
			upload.texto.style.backgroundColor = "#fffccc";
			upload.texto.focus();
			return (false);
			}
			document.upload.enviar.disabled = true;
			document.upload.submit();
			window.status = 'Enviando foto...';
}

// Validação de amigos
// Nome
function valida_amigo() { 
			if (document.amigo.nome.value==""){
			alert("Digite seu nome"); 
			document.amigo.nome.focus()
			amigo.nome.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de amigos
			// E-mail
			if (document.amigo.email.value==""){
			alert("Digite o e-mail de seu amigo."); 
			document.amigo.email.focus()
			amigo.email.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de amigos
			// E-mail válido
			if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(amigo.email.value)))
			{
			alert("Digite o e-mail de seu amigo corretamente.")
			document.amigo.email.focus()
			amigo.email.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de amigos
			// Mensagem
			if (document.amigo.mensagem.value==""){
			alert("Digite a mensagem."); 
			document.amigo.mensagem.focus()
			amigo.mensagem.style.backgroundColor = "#fffccc";
			return false;
			}	
			document.amigo.submit();
}

// Validação de denuncias
// Início da função - nome
function valida_denuncia() { 
			if (document.denuncia.nome.value==""){
			alert("Digite seu nome"); 
			document.denuncia.nome.focus()
			denuncia.nome.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de denuncias
			// E-mail
			if (document.denuncia.email.value==""){
			alert("Digite seu email"); 
			document.denuncia.email.focus()
			denuncia.email.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de denuncias
			// E-mail válido
			if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(denuncia.email.value)))
			{
			alert("Coloque um e-mail válido")
			document.denuncia.email.focus()
			denuncia.email.style.backgroundColor = "#fffccc";
			return false;
			}
				
			// Validação de denuncias
			// Motivo
			if (denuncia.motivo.value == "Selecione"){
			alert("Por favor selecione o motivo.");
			denuncia.motivo.focus();
			denuncia.motivo.style.backgroundColor = "#fffccc";
			return (false);
			}
			
			// Validação de denuncias
			// Solicitação
			if (denuncia.solicitacao.value == "Selecione"){
			alert("Por favor selecione a solicitação.");
			denuncia.solicitacao.focus();
			denuncia.solicitacao.style.backgroundColor = "#fffccc";
			return (false);
			}
			
			// Validação de denuncias
			// Motivo 2
			if (document.denuncia.motivo2.value==""){
			alert("Digite o motivo da denuncia"); 
			document.denuncia.motivo2.focus()
			denuncia.motivo2.style.backgroundColor = "#fffccc";
			return false;
			}
			document.denuncia.submit();
}

// Validação de login
// Usuário (login)
function valida_login() { 

			if (document.login.user.value==""){
			alert("Digite seu login"); 
			document.login.user.focus()
			login.user.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de login
			// Número de caracteres do login
			if (login.user.value.length < 3){
			alert("Seu login deve conter no mínimo 3 caracteres e no máximo 20!")
			login.user.focus();
			login.user.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de login
			// Número máximo de caracteres
			if (login.user.value.length > 20){
			alert("Seu login deve conter no máximo 20 caracteres e no mínimo 3!")
			login.user.style.backgroundColor = "#fffccc";
			login.user.focus();
			return false;
			}
			
			// Validação de login
			// Senha
			if (document.login.pass.value==""){
			alert("Digite sua senha"); 
			document.login.pass.focus()
			login.pass.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de login
			// Senha
			if (login.pass.value.length < 6){
			alert("Sua senha deve conter no mínimo 6 caracteres")
			login.pass.focus();
			login.pass.style.backgroundColor = "#fffccc";
			return false;
			}
//			document.login.login.disabled = true;
//			document.login.login.value = "Logando..."; 
			document.login.submit();
			window.status = 'Efetuando login...';
}

// Validação de contato
// Nome
function valida_contato() { 
			if (document.contato.nome.value==""){
			alert("O preenchimento do seu nome é obrigatório"); 
			document.contato.nome.focus()
			contato.nome.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de contato
			// Nome
			if (contato.nome.value.length < 5){
			alert("Digite um nome válido!")
			contato.nome.focus();
			contato.nome.style.backgroundColor = "#fffccc";
			return (false);
			}
			
			// Validação de contato
			// Email
			if(document.contato.email.value=="") {
			alert("O preenchimento de seu e-mail é obrigatório");
			document.contato.email	.focus()
			contato.email.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de contato
			// Email
			if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(contato.email.value)))
			{
			alert("Coloque um e-mail válido")
			document.contato.email.focus()
			contato.email.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de contato
			// Cidade
			if (document.contato.cidade.value==""){
			alert("O preenchimento de sua cidade é obrigatório"); 
			document.contato.cidade.focus()
			contato.cidade.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de contato
			// Cidade
			if (contato.cidade.value.length < 5){
			alert("Digite uma cidade válida!")
			contato.cidade.focus();
			contato.cidade.style.backgroundColor = "#fffccc";
			return (false);
			}
			
			// Validação de contato
			// Àrea
			if (contato.area.value == "Selecione"){
			alert("Por favor selecione uma Área.");
			contato.area.focus();
			contato.area.style.backgroundColor = "#fffccc";
			return (false);
			}
			
			// Validação de contato
			// Mensagem
			if (document.contato.mensagem.value==""){
			alert("O preenchimento da mensagem é obrigatório"); 
			document.contato.mensagem.focus()
			contato.mensagem.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de contato
			// Mensagem
			if (contato.mensagem.value.length < 10){
			alert("Sua mensagem deve ter no mínimo 10 caracteres")
			contato.mensagem.focus();
			contato.mensagem.style.backgroundColor = "#fffccc";
			return (false);
			}
			document.contato.submit();
}

// VALIDAÇÃO DE CADASTRO //
// VALIDAÇÃO DE CADASTRO //
// VALIDAÇÃO DE CADASTRO //
function  valida_cadastro(){

			var nomes_proibidos = new Array('folox','f0l0x','f0lox','fol0x','folox.net','info_folox','equipe_folox','folox_oficial');
			var contem_nomes = document.cadastro.login.value;
			
			if(in_array(contem_nomes,nomes_proibidos)){
			alert("Você está tentando cadastrar um usuário com o nome "+contem_nomes+"\nNão são permitidos cadastros onde o login do usuário tenha o nome folox no meio.\n");
			document.cadastro.login.focus()
			cadastro.login.style.backgroundColor = "#fffccc";
			return false;
			}
			
			
			// Validação de CADASTRO
			// Login
			if (document.cadastro.login.value==""){
			alert("O preenchimento do seu login é obrigatório"); 
			document.cadastro.login.focus()
			cadastro.login.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// Login
			if (cadastro.login.value.length < 6){
			alert("O campo login deve ter no mínimo 6 caracteres!")
			cadastro.login.focus();
			cadastro.login.style.backgroundColor = "#fffccc";
			return (false);
			}	
			
			// Validação de CADASTRO
			// Login
			if (cadastro.login.value.length > 20){
			alert("O campo login deve ter no máximo 20 caracteres!")
			cadastro.login.focus();
			cadastro.login.style.backgroundColor = "#fffccc";
			return (false);
			}	
			
			// Verificando se a senha é a mesma do login
			if (cadastro.senha.value == cadastro.login.value){
			alert("A senha não pode ser igual ao usuário(login)!");
			cadastro.senha.focus();
			cadastro.senha.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// Senha
			if (document.cadastro.senha.value==""){
			alert("O preenchimento da senha é obrigatório"); 
			document.cadastro.senha.focus()
			cadastro.senha.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// Senha
			if (cadastro.senha.value.length < 6){
			alert("O campo senha deve ter no mínimo 6 caracteres!")
			cadastro.senha.focus();
			cadastro.senha.style.backgroundColor = "#fffccc";
			return false;
			}	
			
			// Validação de CADASTRO
			// Senha
			if (cadastro.senha.value.length > 20){
			alert("O campo senha deve ter no máximo 20 caracteres!")
			cadastro.senha.focus();
			cadastro.senha.style.backgroundColor = "#fffccc";
			return false;
			}	
			
			// Verificando se a senha é a mesma do lembrete
			if (cadastro.lembrete.value == cadastro.senha.value){
			alert("O lembrete da senha não pode ser a senha!");
			cadastro.lembrete.focus();
			cadastro.lembrete.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// Senha
			if (document.cadastro.confirma_senha.value==""){
			alert("É necessária a confirmação de sua senha"); 
			document.cadastro.confirma_senha.focus()
			cadastro.confirma_senha.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// Senha
			if (cadastro.senha.value != cadastro.confirma_senha.value){
			alert("A senha do confirma senha é diferente da senha digitada!");
			cadastro.confirma_senha.focus();
			cadastro.confirma_senha.style.backgroundColor = "#fffccc";
			return false;
			}	
			
			// Validação de CADASTRO
			// Lembrete de senha
			if (document.cadastro.lembrete.value==""){
			alert("Digite um lembrete para sua senha"); 
			document.cadastro.lembrete.focus();
			cadastro.lembrete.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// Estado
			if (document.cadastro.id_uf.value==""){
			alert("Por favor, selecione um estado!"); 
			document.cadastro.id_uf.focus();
			cadastro.id_uf.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// Estado (SELECIONE)
			if (cadastro.id_uf.value == "Selecione"){
			alert("Por favor, selecione um estado!"); 
			document.cadastro.id_uf.focus();
			cadastro.id_uf.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// Cidade
			if (cadastro.cidade.value == ""){
			alert("Por favor, selecione uma cidade!"); 
			document.cadastro.cidade.focus()
			cadastro.cidade.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// Cidade (SELECIONE)
			if (cadastro.cidade.value == "Selecione"){
			alert("Por favor, selecione uma cidade!"); 
			document.cadastro.cidade.focus()
			cadastro.cidade.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// Email
			if(document.cadastro.email.value=="") {
			alert("O preenchimento de seu e-mail é obrigatório");
			document.cadastro.email.focus()
			cadastro.email.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// Email
			if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(cadastro.email.value)))
			{
			alert("Coloque um e-mail válido")
			document.cadastro.email.focus()
			cadastro.email.style.backgroundColor = "#fffccc";
			return false;
			}
			
			if (document.cadastro.confirma_email.value==""){
			alert("É necessário a confirmação do seu e-mail no cadastro."); 
			document.cadastro.confirma_email.focus()
			cadastro.confirma_email.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// Confirmação de email
			if (cadastro.email.value != cadastro.confirma_email.value){
			alert("O e-mail digitado no campo de confirmação é diferente do e-mail informado.");
			cadastro.confirma_email.focus();
			cadastro.confirma_email.style.backgroundColor = "#fffccc";
			return (false);
			}
			
			// Validação de CADASTRO
			// Seleção de categoria
			if (cadastro.categoria.value == "Selecione"){
			alert("Selecione uma categoria!");
			cadastro.categoria.focus();
			cadastro.categoria.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// nome
			if (document.cadastro.nome.value==""){
			alert("O preenchimento do seu primeiro nome é obrigatório"); 
			document.cadastro.nome.focus()
			cadastro.nome.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// segundo nome
			if (document.cadastro.sobrenome.value==""){
			alert("O preenchimento do seu segundo nome é obrigatório"); 
			document.cadastro.sobrenome.focus()
			cadastro.sobrenome.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// Nascimento
			if (cadastro.dia.value == "dia"){
			alert("Por favor selecione o dia de seu nascimento.");
			cadastro.dia.focus();
			cadastro.dia.style.backgroundColor = "#fffccc";
			return false;
			}
			if (cadastro.mes.value == "mes"){
			alert("Por favor selecione o mês de seu nascimento.");
			cadastro.mes.focus();
			cadastro.mes.style.backgroundColor = "#fffccc";
			return false;
			}
			if (cadastro.ano.value == "ano"){
			alert("Por favor selecione o ano em que nasceu.");
			cadastro.ano.focus();
			cadastro.ano.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// Sexo
			if (cadastro.sexo.value == "Selecione"){
			alert("Por favor selecione seu Sexo!");
			cadastro.sexo.focus();
			cadastro.sexo.style.backgroundColor = "#fffccc";
			return false;
			}
			
			// Validação de CADASTRO
			// MSN
			if(document.cadastro.msn.value !== "") {
			if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(cadastro.msn.value)))
			{
			alert("Coloque um MSN válido")
			document.cadastro.msn.focus()
			cadastro.msn.style.backgroundColor = "#fffccc";
			return false;
			}
			}
			if (cadastro.textimage.value == ""){
			alert("Digite o que você ve na imagem ao lado!");
			cadastro.textimage.focus();
			cadastro.textimage.style.backgroundColor = "#fffccc";
			return false;
			}
			document.cadastro.submit();
}
	
// Validação numérica
function numerico(e) {
			if (document.all) // Internet Explorer
			var tecla = event.keyCode;
			else if(document.layers) // Nestcape
			var tecla = e.which;
			if (tecla > 47 && tecla < 58) // numeros de 0 a 9
			return true;
			else {
			if (tecla != 8) // backspace
			event.keyCode = 0;
			//return false;
			else
			return true;
			}
}

// Validação de caracteres
function troca(campo) { 
			campo.value = campo.value.toLowerCase(); 
			var estranha = "áéíóúàèìòùâêîôûäëïöüãõ@#$%^&*()´+=-~` ç"; 
			var correta  = "aeiouaeiouaeiouaeiouao________________c"; 
			var retorno  = ""; 
			for(i=0;i<estranha.length;i++) 
			{ 
			for(j=0;j<campo.value.length;j++) 
			{ 
			retorno = campo.value.replace(estranha.substr(i,1),correta.substr(i,1)); 
			campo.value = retorno; 
			} 
			} 
} 

function blockNumbers(e)
{
			var key;
			var keychar;
			var reg;
			
			if(window.event) {
				// for IE, e.keyCode or window.event.keyCode can be used
				key = e.keyCode; 
			}
			else if(e.which) {
				// netscape
				key = e.which; 
			}
			else {
				// no event, so pass through
				return true;
			}
		
			keychar = String.fromCharCode(key);
			reg = /\d/;
			return !reg.test(keychar);
}

//
function valida_avatar() { 

		if (document.avatar.avatar.value==""){
		alert("Selecione uma foto!\n\n Clique em Procurar"); 
		document.avatar.avatar.focus()
		avatar.avatar.style.backgroundColor = "#fffccc";
		document.avatar.enviar.disabled = false;
		return false;
		}
		
		var ext_permitidas = new Array('jpg','jpeg','gif','png');
		var extensao = document.avatar.avatar.value.substr(document.avatar.avatar.value.length - 3).toLowerCase();
		
		if(!in_array(extensao,ext_permitidas)){
		alert("Você está tentando mandar um arquivo de extensão ."+extensao+".\nFormatos de fotos aceitos: JPG, JPEG, GIF e PNG\n");
		document.avatar.avatar.focus()
		avatar.avatar.style.backgroundColor = "#fffccc";
		document.avatar.enviar.disabled = false;
		return false;
		}
		
		if(document.avatar.avatar.fileSize > 1024){
		alert("- Tamanho da foto é maior que o permitido (1 MB).");
		document.avatar.avatar.focus()
		avatar.avatar.style.backgroundColor = "#fffccc";
		document.avatar.enviar.disabled = false;
		return false;
		}
		document.avatar.enviar.disabled = true;
		document.avatar.submit();
		window.status = 'Enviando avatar...';
}