function ValidaUsuario()
{	

	if(document.Cadastro.tipoPessoa[0].checked)
	{
		/*if(document.Cadastro.usuarioCpf.value == "")
		{
			document.getElementById('tipo').innerHTML='<font color=red >CPF:</font>';
			alert('Digite seu CPF');
			document.Cadastro.usuarioCpf.focus();
			return false;
		}
		
		else */if(document.Cadastro.usuarioNome.value == "")
		{
		document.getElementById('tipo2').innerHTML='<font color=red >Nome:</font>';
		alert('Digite campo nome de usuário');
		document.Cadastro.usuarioNome.focus();
		return false;
		}

	}
	
	else
	{
		/*if(document.Cadastro.usuarioCnpj.value == "")
		{
			document.getElementById('tipo').innerHTML='<font color=red >CNPJ:</font>';
			alert('Digite seu CNPJ');
			document.Cadastro.usuarioCnpj.focus();
			return false;
		}
		
		else */if(document.Cadastro.usuarioRazaoSocial.value == "")
		{
		document.getElementById('tipo2').innerHTML='<font color=red >Razão Social:</font>';
		alert('Digite campo razão social');
		document.Cadastro.usuarioRazaoSocial.focus();
		return false;
		}
		
	}
	

	if(document.Cadastro.usuarioEmail.value == "")
	{
		document.getElementById('email2').innerHTML='<font color=red >E-mail:</font>';
		alert('Digite E-mail');
		document.Cadastro.usuarioEmail.focus();
		return false;
	}	
	else
	{
		
		if(!valida_EMAIL(document.Cadastro.usuarioEmail.value))
		{
			document.getElementById('email2').innerHTML='<font color=red >E-mail:</font>';
			alert('Digite E-mail Válido');
			document.Cadastro.usuarioEmail.focus();
			return false;	
		}
	
	}
	
	
	if(document.Cadastro.usuarioSenha.value == "")
	{
		document.getElementById('senha2').innerHTML='<font color=red >Senha:</font>';
		alert('Digite Senha');
		document.Cadastro.usuarioSenha.focus();
		return false;
	}	
	
	if(document.Cadastro.usuarioConfirmaSenha.value == "")
	{
		document.getElementById('senhaconfirma').innerHTML='<font color=red >Confirma Senha:</font>';
		alert('Digite a Confirmação da Senha');
		document.Cadastro.usuarioConfirmaSenha.focus();
		return false;
	}	
	
	if(document.Cadastro.usuarioSenha.value != document.Cadastro.usuarioConfirmaSenha.value)
	{
		document.getElementById('senhaconfirma').innerHTML='<font color=red >Confirma Senha:</font>';
		alert('Senha não confere, digite novamente!');
		document.Cadastro.usuarioConfirmaSenha.focus();
		return false;
	}		
	
}



function ValidaFoto()
{
	
	if(document.Foto.foto.value == "")
	{
		alert('Procure uma foto...');
		document.Foto.foto.focus();
		return false;
	}else
	{
		Progresso();
	}
	
	
}



function ValidaAlbumdefotos()
{
	
	if(document.Foto.foto.value == "")
	{
		alert('Procure uma foto...');
		document.Foto.foto.focus();
		return false;
	}
	
	if(document.Foto.albumdefotosDescricao.value == "")
	{
		alert('Digite uma descrição para sua foto');
		document.Foto.albumdefotosDescricao.focus();
		return false;
	}
	
	Progresso();
	
}



function ValidaLogotipo()
{
	
	if(document.Logotipo.foto.value == "")
	{
		document.getElementById('addlogotipo').innerHTML='<font color=red >Adicionar Logotipo:</font>';
		alert('Procure um logotipo...');
		document.Logotipo.foto.focus();
		return false;
	}	
	
}


function ValidaMapa()
{
	
	if(document.Mapa.foto.value == "")
	{
		document.getElementById('addmapa').innerHTML='<font color=red >Adicionar Mapa:</font>';
		alert('Procure um mapa...');
		document.Mapa.foto.focus();
		return false;
	}	
	
}


function ValidaEtapa2()
{
	
	
	if(document.Cadastrar.anuncioFormaValor.value == "")
	{
		alert('Digite valor da parcela!');
		document.Cadastrar.anuncioFormaValor.focus();
		return false;
	}

	
}


function ValidaEtapa2Alterar()
{
		
	if(document.Atualizar.anuncioOpcao[0].checked == false && document.Atualizar.anuncioOpcao[1].checked == false)
	{
		alert('Escolha Opção de Anúncio');
		return false;
	}
	
	if(document.Atualizar.nomeminisite.value == "" && document.Atualizar.anuncioOpcao[1].checked == true)
	{
		alert('Digite o nome para o mini site');
		document.Atualizar.nomeminisite.focus();
		return false;
	}	

}


function ValidaAnuncio()
{	


	if(document.Cadastro.anuncioCategoria.selectedIndex == 0)
	{
		document.getElementById('categoria').innerHTML='<font color=red >Categoria:</font>';
		alert('Selecione categoria');
		document.Cadastro.anuncioCategoria.focus();
		return false;
	}	
		

		
	var indice = document.Cadastro.anuncioCategoria.selectedIndex;
	var opindice = document.Cadastro.anuncioCategoria.options[indice].value;
	
	var indice2 = document.Cadastro.anuncioSubCategoria.selectedIndex;
	var opindice2 = document.Cadastro.anuncioSubCategoria.options[indice2].value;
	
		
	if(opindice == "new" && document.Cadastro.anuncioNewCategoria.value == "")
	{
		document.getElementById('newcategoria').innerHTML='<font color=red >Nova Categoria:</font>';
		alert('Digite nova categoria');
		document.Cadastro.anuncioNewCategoria.focus();
		return false;
	}	
	
	if(opindice2 == "new" && document.Cadastro.anuncioNewSubCategoria.value == "")
	{
		document.getElementById('newsubcategoria').innerHTML='<font color=red >Nova Sub Categoria:</font>';
		alert('Digite nova sub categoria');
		document.Cadastro.anuncioNewSubCategoria.focus();
		return false;
	}	
	
	
	if(document.Cadastro.anuncioSubCategoria.selectedIndex == 0)
	{
		document.getElementById('categoria').innerHTML='<font color=red >Sub Categoria:</font>';
		alert('Selecione sub categoria');
		document.Cadastro.anuncioSubCategoria.focus();
		return false;
	}	

	
	if(document.Cadastro.anuncioNome.value == "")
	{
		document.getElementById('nomeanuncio').innerHTML='<font color=red >Nome:</font>';
		alert('Digite campo nome de anúncio');
		document.Cadastro.anuncioNome.focus();
		return false;
	}
	
	
	if(document.Cadastro.anuncioEmail.value)
	{
		
		if(!valida_EMAIL(document.Cadastro.anuncioEmail.value))
		{
			document.getElementById('emailanuncio').innerHTML='<font color=red >E-mail:</font>';
			alert('Digite E-mail Válido para o Anuncio');
			document.Cadastro.anuncioEmail.focus();
			return false;	
		}
		
	}
	
	
	if(document.Cadastro.anuncioTelefoneDDD.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite DDD do Telefone');
		document.Cadastro.anuncioTelefoneDDD.focus();
		return false;
	}		
	
	
	if(document.Cadastro.anuncioTelefoneNumero.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite o Telefone');
		document.Cadastro.anuncioTelefoneNumero.focus();
		return false;
	}	

	
/*	if(document.Cadastro.tipoCadastro[1].checked)
	{
		if(document.Cadastro.anuncioCategoria.selectedIndex == 0)
	{
		document.getElementById('categoria').innerHTML='<font color=red >Categoria:</font>';
		alert('Selecione categoria');
		document.Cadastro.anuncioCategoria.focus();
		return false;
	}	
		

		
	var indice = document.Cadastro.anuncioCategoria.selectedIndex;
	var opindice = document.Cadastro.anuncioCategoria.options[indice].value;
	
	var indice2 = document.Cadastro.anuncioSubCategoria.selectedIndex;
	var opindice2 = document.Cadastro.anuncioSubCategoria.options[indice2].value;
	
		
	if(opindice == "new" && document.Cadastro.anuncioNewCategoria.value == "")
	{
		document.getElementById('newcategoria').innerHTML='<font color=red >Nova Categoria:</font>';
		alert('Digite nova categoria');
		document.Cadastro.anuncioNewCategoria.focus();
		return false;
	}	
	
	if(opindice2 == "new" && document.Cadastro.anuncioNewSubCategoria.value == "")
	{
		document.getElementById('newsubcategoria').innerHTML='<font color=red >Nova Sub Categoria:</font>';
		alert('Digite nova sub categoria');
		document.Cadastro.anuncioNewSubCategoria.focus();
		return false;
	}	
	
	
	if(document.Cadastro.anuncioSubCategoria.selectedIndex == 0)
	{
		document.getElementById('categoria').innerHTML='<font color=red >Sub Categoria:</font>';
		alert('Selecione sub categoria');
		document.Cadastro.anuncioSubCategoria.focus();
		return false;
	}	
	
	if(document.Cadastro.anuncioDescricao.value == "")
	{
		document.getElementById('descricao').innerHTML='<font color=red >Descrição:</font>';
		alert('Digite Descrição do anúncio');
		document.Cadastro.anuncioDescricao.focus();
		return false;
	}

	
	if(document.Cadastro.anuncioNome.value == "")
	{
		document.getElementById('nomeanuncio').innerHTML='<font color=red >Nome:</font>';
		alert('Digite campo nome de anúncio');
		document.Cadastro.anuncioNome.focus();
		return false;
	}
	
	
		if(document.Cadastro.anuncioEmail.value == "")
	{
		document.getElementById('emailanuncio').innerHTML='<font color=red >E-mail:</font>';
		alert('Digite Email do Anuncio');
		document.Cadastro.anuncioEmail.focus();
		return false;
	}	
	else
	{
		
		if(!valida_EMAIL(document.Cadastro.anuncioEmail.value))
		{
			document.getElementById('emailanuncio').innerHTML='<font color=red >E-mail:</font>';
			alert('Digite E-mail Válido para o Anuncio');
			document.Cadastro.anuncioEmail.focus();
			return false;	
		}
		

	}
	
	if(document.Cadastro.anuncioEndereco.value == "")
	{
		document.getElementById('endereco').innerHTML='<font color=red >Endereço:</font>';
		alert('Digite campo endereço');
		document.Cadastro.anuncioEndereco.focus();
		return false;
	}

	if(document.Cadastro.anuncioEnderecoNumero.value == "")
	{
		alert('Digite campo número');
		document.Cadastro.anuncioEnderecoNumero.focus();
		return false;
	}
	
	if(document.Cadastro.anuncioEnderecoBairro.value == "")
	{
		document.getElementById('bairro').innerHTML='<font color=red >Bairro:</font>';
		alert('Digite campo bairro');
		document.Cadastro.anuncioEnderecoBairro.focus();
		return false;
	}	
	
	if(document.Cadastro.uf.selectedIndex == 0)
	{
		document.getElementById('estado').innerHTML='<font color=red >Estado:</font>';
		alert('Selecione seu estado');
		document.Cadastro.uf.focus();
		return false;
	}
	
	if(document.Cadastro.city.selectedIndex == 0)
	{
		document.getElementById('cidade').innerHTML='<font color=red >Cidade:</font>';
		alert('Selecione sua cidade');
		document.Cadastro.city.focus();
		return false;
	}	
	
	
	if(document.Cadastro.anuncioEnderecoCep.value == "")
	{
		document.getElementById('cep').innerHTML='<font color=red >Cep:</font>';
		alert('Digite Cep');
		document.Cadastro.anuncioEnderecoCep.focus();
		return false;
	}	
	
	if(document.Cadastro.anuncioEnderecoCep2.value == "")
	{
		document.getElementById('cep').innerHTML='<font color=red >Cep:</font>';
		alert('Digite Cep');
		document.Cadastro.anuncioEnderecoCep2.focus();
		return false;
	}	
	
	if(document.Cadastro.anuncioTelefoneDDD.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite DDD do Telefone');
		document.Cadastro.anuncioTelefoneDDD.focus();
		return false;
	}		
	
	
	
	
	if(document.Cadastro.anuncioTelefoneNumero.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite o Telefone');
		document.Cadastro.anuncioTelefoneNumero.focus();
		return false;
	}

	
}*/
}




function ValidaAnuncioAlterar()
{	

	if(document.Cadastro.anuncioNome.value == "")
	{
		document.getElementById('nomeanuncio').innerHTML='<font color=red >Nome:</font>';
		alert('Digite campo nome de anúncio');
		document.Cadastro.anuncioNome.focus();
		return false;
	}
	
	
	if(document.Cadastro.anuncioEmail.value)
	{
		
		if(!valida_EMAIL(document.Cadastro.anuncioEmail.value))
		{
			document.getElementById('emailanuncio').innerHTML='<font color=red >E-mail:</font>';
			alert('Digite E-mail Válido para o Anuncio');
			document.Cadastro.anuncioEmail.focus();
			return false;	
		}
		
	}
	
	
	if(document.Cadastro.anuncioTelefoneDDD.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite DDD do Telefone');
		document.Cadastro.anuncioTelefoneDDD.focus();
		return false;
	}		
	
	
	if(document.Cadastro.anuncioTelefoneNumero.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite o Telefone');
		document.Cadastro.anuncioTelefoneNumero.focus();
		return false;
	}	


}





function ValidaAnuncioPago()
{	


	if(document.Cadastro.anuncioCategoria.selectedIndex == 0)
	{
		document.getElementById('categoria').innerHTML='<font color=red >Categoria:</font>';
		alert('Selecione categoria');
		document.Cadastro.anuncioCategoria.focus();
		return false;
	}	
		

		
	var indice = document.Cadastro.anuncioCategoria.selectedIndex;
	var opindice = document.Cadastro.anuncioCategoria.options[indice].value;
	
	var indice2 = document.Cadastro.anuncioSubCategoria.selectedIndex;
	var opindice2 = document.Cadastro.anuncioSubCategoria.options[indice2].value;
	
		
	if(opindice == "new" && document.Cadastro.anuncioNewCategoria.value == "")
	{
		document.getElementById('newcategoria').innerHTML='<font color=red >Nova Categoria:</font>';
		alert('Digite nova categoria');
		document.Cadastro.anuncioNewCategoria.focus();
		return false;
	}	
	
	if(opindice2 == "new" && document.Cadastro.anuncioNewSubCategoria.value == "")
	{
		document.getElementById('newsubcategoria').innerHTML='<font color=red >Nova Sub Categoria:</font>';
		alert('Digite nova sub categoria');
		document.Cadastro.anuncioNewSubCategoria.focus();
		return false;
	}	
	
	
	if(document.Cadastro.anuncioSubCategoria.selectedIndex == 0)
	{
		document.getElementById('categoria').innerHTML='<font color=red >Sub Categoria:</font>';
		alert('Selecione sub categoria');
		document.Cadastro.anuncioSubCategoria.focus();
		return false;
	}	

	
	if(document.Cadastro.anuncioNome.value == "")
	{
		document.getElementById('nomeanuncio').innerHTML='<font color=red >Nome:</font>';
		alert('Digite campo nome de anúncio');
		document.Cadastro.anuncioNome.focus();
		return false;
	}
	
	
	if(document.Cadastro.anuncioEmail.value)
	{
		
		if(!valida_EMAIL(document.Cadastro.anuncioEmail.value))
		{
			document.getElementById('emailanuncio').innerHTML='<font color=red >E-mail:</font>';
			alert('Digite E-mail Válido para o Anuncio');
			document.Cadastro.anuncioEmail.focus();
			return false;	
		}
		
	}
	
	
	
	
	if(document.Cadastro.anuncioDescricao.value == "")
	{
		document.getElementById('descricao').innerHTML='<font color=red >Descrição:</font>';
		alert('Digite Descrição do anúncio');
		document.Cadastro.anuncioDescricao.focus();
		return false;
	}
	
	
	if(document.Cadastro.anuncioLogin.value == "")
	{
		alert('Digite Endereço do anúncio');
		document.Cadastro.anuncioLogin.focus();
		return false;
	}
	
	if(document.Cadastro.anuncioDescricao.value == "")
	{
		document.getElementById('descricao').innerHTML='<font color=red >Descrição:</font>';
		alert('Digite Descrição do anúncio');
		document.Cadastro.anuncioDescricao.focus();
		return false;
	}

	
	if(document.Cadastro.anuncioNome.value == "")
	{
		document.getElementById('nomeanuncio').innerHTML='<font color=red >Nome:</font>';
		alert('Digite campo nome de anúncio');
		document.Cadastro.anuncioNome.focus();
		return false;
	}
	
	
		if(document.Cadastro.anuncioEmail.value == "")
	{
		document.getElementById('emailanuncio').innerHTML='<font color=red >E-mail:</font>';
		alert('Digite Email do Anuncio');
		document.Cadastro.anuncioEmail.focus();
		return false;
	}	
	else
	{
		
		if(!valida_EMAIL(document.Cadastro.anuncioEmail.value))
		{
			document.getElementById('emailanuncio').innerHTML='<font color=red >E-mail:</font>';
			alert('Digite E-mail Válido para o Anuncio');
			document.Cadastro.anuncioEmail.focus();
			return false;	
		}
		

	}
	
	if(document.Cadastro.anuncioEndereco.value == "")
	{
		document.getElementById('endereco').innerHTML='<font color=red >Endereço:</font>';
		alert('Digite campo endereço');
		document.Cadastro.anuncioEndereco.focus();
		return false;
	}

	if(document.Cadastro.anuncioEnderecoNumero.value == "")
	{
		alert('Digite campo número');
		document.Cadastro.anuncioEnderecoNumero.focus();
		return false;
	}
	
	if(document.Cadastro.anuncioEnderecoBairro.value == "")
	{
		document.getElementById('bairro').innerHTML='<font color=red >Bairro:</font>';
		alert('Digite campo bairro');
		document.Cadastro.anuncioEnderecoBairro.focus();
		return false;
	}	
	
	if(document.Cadastro.uf.selectedIndex == 0)
	{
		document.getElementById('estado').innerHTML='<font color=red >Estado:</font>';
		alert('Selecione seu estado');
		document.Cadastro.uf.focus();
		return false;
	}
	
	if(document.Cadastro.city.selectedIndex == 0)
	{
		document.getElementById('cidade').innerHTML='<font color=red >Cidade:</font>';
		alert('Selecione sua cidade');
		document.Cadastro.city.focus();
		return false;
	}	
	
	
	if(document.Cadastro.anuncioEnderecoCep.value == "")
	{
		document.getElementById('cep').innerHTML='<font color=red >Cep:</font>';
		alert('Digite Cep');
		document.Cadastro.anuncioEnderecoCep.focus();
		return false;
	}	
	
	if(document.Cadastro.anuncioEnderecoCep2.value == "")
	{
		document.getElementById('cep').innerHTML='<font color=red >Cep:</font>';
		alert('Digite Cep');
		document.Cadastro.anuncioEnderecoCep2.focus();
		return false;
	}	
	
	if(document.Cadastro.anuncioTelefoneDDD.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite DDD do Telefone');
		document.Cadastro.anuncioTelefoneDDD.focus();
		return false;
	}		
	
	
	
	
	if(document.Cadastro.anuncioTelefoneNumero.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite o Telefone');
		document.Cadastro.anuncioTelefoneNumero.focus();
		return false;
	}

}





function ValidaCompleto(pegaID)
{	

if(pegaID == -1)
{
	if(document.Cadastro.tipoPessoa[0].checked)
	{
		if(document.Cadastro.usuarioCpf.value == "")
		{
			document.getElementById('tipo').innerHTML='<font color=red >CPF:</font>';
			alert('Digite seu CPF');
			document.Cadastro.usuarioCpf.focus();
			return false;
		}
		
		else if(document.Cadastro.usuarioNome.value == "")
		{
		document.getElementById('tipo2').innerHTML='<font color=red >Nome:</font>';
		alert('Digite campo nome de usuário');
		document.Cadastro.usuarioNome.focus();
		return false;
		}

	}
	
	else
	{
		if(document.Cadastro.usuarioCnpj.value == "")
		{
			document.getElementById('tipo').innerHTML='<font color=red >CNPJ:</font>';
			alert('Digite seu CNPJ');
			document.Cadastro.usuarioCnpj.focus();
			return false;
		}
		
		else if(document.Cadastro.usuarioRazaoSocial.value == "")
		{
		document.getElementById('tipo2').innerHTML='<font color=red >Razão Social:</font>';
		alert('Digite campo razão social');
		document.Cadastro.usuarioRazaoSocial.focus();
		return false;
		}
		
	}
	

	if(document.Cadastro.usuarioEmail.value == "")
	{
		document.getElementById('email2').innerHTML='<font color=red >E-mail:</font>';
		alert('Digite E-mail');
		document.Cadastro.usuarioEmail.focus();
		return false;
	}	
	else
	{
		
		if(!valida_EMAIL(document.Cadastro.usuarioEmail.value))
		{
			document.getElementById('email2').innerHTML='<font color=red >E-mail:</font>';
			alert('Digite E-mail Válido');
			document.Cadastro.usuarioEmail.focus();
			return false;	
		}
	
	}
	
	
	if(document.Cadastro.usuarioSenha.value == "")
	{
		document.getElementById('senha2').innerHTML='<font color=red >Senha:</font>';
		alert('Digite Senha');
		document.Cadastro.usuarioSenha.focus();
		return false;
	}	
	
	if(document.Cadastro.usuarioConfirmaSenha.value == "")
	{
		document.getElementById('senhaconfirma').innerHTML='<font color=red >Confirma Senha:</font>';
		alert('Digite a Confirmação da Senha');
		document.Cadastro.usuarioConfirmaSenha.focus();
		return false;
	}	
	
	if(document.Cadastro.usuarioSenha.value != document.Cadastro.usuarioConfirmaSenha.value)
	{
		document.getElementById('senhaconfirma').innerHTML='<font color=red >Confirma Senha:</font>';
		alert('Senha não confere, digite novamente!');
		document.Cadastro.usuarioConfirmaSenha.focus();
		return false;
	}	
}


	if(document.Cadastro.tipoCadastro[0].checked)
	{

	if(document.Cadastro.anuncioCategoria.selectedIndex == 0)
	{
		document.getElementById('categoria').innerHTML='<font color=red >Categoria:</font>';
		alert('Selecione categoria');
		document.Cadastro.anuncioCategoria.focus();
		return false;
	}	
		

		
	var indice = document.Cadastro.anuncioCategoria.selectedIndex;
	var opindice = document.Cadastro.anuncioCategoria.options[indice].value;
	
	var indice2 = document.Cadastro.anuncioSubCategoria.selectedIndex;
	var opindice2 = document.Cadastro.anuncioSubCategoria.options[indice2].value;
	
		
	if(opindice == "new" && document.Cadastro.anuncioNewCategoria.value == "")
	{
		document.getElementById('newcategoria').innerHTML='<font color=red >Nova Categoria:</font>';
		alert('Digite nova categoria');
		document.Cadastro.anuncioNewCategoria.focus();
		return false;
	}	
	
	if(opindice2 == "new" && document.Cadastro.anuncioNewSubCategoria.value == "")
	{
		document.getElementById('newsubcategoria').innerHTML='<font color=red >Nova Sub Categoria:</font>';
		alert('Digite nova sub categoria');
		document.Cadastro.anuncioNewSubCategoria.focus();
		return false;
	}	
	
	
	if(document.Cadastro.anuncioSubCategoria.selectedIndex == 0)
	{
		document.getElementById('categoria').innerHTML='<font color=red >Sub Categoria:</font>';
		alert('Selecione sub categoria');
		document.Cadastro.anuncioSubCategoria.focus();
		return false;
	}	

	
	if(document.Cadastro.anuncioNome.value == "")
	{
		document.getElementById('nomeanuncio').innerHTML='<font color=red >Nome:</font>';
		alert('Digite campo nome de anúncio');
		document.Cadastro.anuncioNome.focus();
		return false;
	}
	
	
	if(document.Cadastro.anuncioEmail.value)
	{
		
		if(!valida_EMAIL(document.Cadastro.anuncioEmail.value))
		{
			document.getElementById('emailanuncio').innerHTML='<font color=red >E-mail:</font>';
			alert('Digite E-mail Válido para o Anuncio');
			document.Cadastro.anuncioEmail.focus();
			return false;	
		}
		
	}
	
	
	if(document.Cadastro.anuncioTelefoneDDD.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite DDD do Telefone');
		document.Cadastro.anuncioTelefoneDDD.focus();
		return false;
	}		
	
	
	if(document.Cadastro.anuncioTelefoneNumero.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite o Telefone');
		document.Cadastro.anuncioTelefoneNumero.focus();
		return false;
	}	

	}
	
	if(document.Cadastro.tipoCadastro[1].checked)
	{
		if(document.Cadastro.anuncioCategoria.selectedIndex == 0)
	{
		document.getElementById('categoria').innerHTML='<font color=red >Categoria:</font>';
		alert('Selecione categoria');
		document.Cadastro.anuncioCategoria.focus();
		return false;
	}	
		

		
	var indice = document.Cadastro.anuncioCategoria.selectedIndex;
	var opindice = document.Cadastro.anuncioCategoria.options[indice].value;
	
	var indice2 = document.Cadastro.anuncioSubCategoria.selectedIndex;
	var opindice2 = document.Cadastro.anuncioSubCategoria.options[indice2].value;
	
		
	if(opindice == "new" && document.Cadastro.anuncioNewCategoria.value == "")
	{
		document.getElementById('newcategoria').innerHTML='<font color=red >Nova Categoria:</font>';
		alert('Digite nova categoria');
		document.Cadastro.anuncioNewCategoria.focus();
		return false;
	}	
	
	if(opindice2 == "new" && document.Cadastro.anuncioNewSubCategoria.value == "")
	{
		document.getElementById('newsubcategoria').innerHTML='<font color=red >Nova Sub Categoria:</font>';
		alert('Digite nova sub categoria');
		document.Cadastro.anuncioNewSubCategoria.focus();
		return false;
	}	
	
	
	if(document.Cadastro.anuncioSubCategoria.selectedIndex == 0)
	{
		document.getElementById('categoria').innerHTML='<font color=red >Sub Categoria:</font>';
		alert('Selecione sub categoria');
		document.Cadastro.anuncioSubCategoria.focus();
		return false;
	}	
	
	if(document.Cadastro.anuncioDescricao.value == "")
	{
		document.getElementById('descricao').innerHTML='<font color=red >Descrição:</font>';
		alert('Digite Descrição do anúncio');
		document.Cadastro.anuncioDescricao.focus();
		return false;
	}

	
	if(document.Cadastro.anuncioNome.value == "")
	{
		document.getElementById('nomeanuncio').innerHTML='<font color=red >Nome:</font>';
		alert('Digite campo nome de anúncio');
		document.Cadastro.anuncioNome.focus();
		return false;
	}
	
	
		if(document.Cadastro.anuncioEmail.value == "")
	{
		document.getElementById('emailanuncio').innerHTML='<font color=red >E-mail:</font>';
		alert('Digite Email do Anuncio');
		document.Cadastro.anuncioEmail.focus();
		return false;
	}	
	else
	{
		
		if(!valida_EMAIL(document.Cadastro.anuncioEmail.value))
		{
			document.getElementById('emailanuncio').innerHTML='<font color=red >E-mail:</font>';
			alert('Digite E-mail Válido para o Anuncio');
			document.Cadastro.anuncioEmail.focus();
			return false;	
		}
		

	}
	
	if(document.Cadastro.anuncioEndereco.value == "")
	{
		document.getElementById('endereco').innerHTML='<font color=red >Endereço:</font>';
		alert('Digite campo endereço');
		document.Cadastro.anuncioEndereco.focus();
		return false;
	}

	if(document.Cadastro.anuncioEnderecoNumero.value == "")
	{
		alert('Digite campo número');
		document.Cadastro.anuncioEnderecoNumero.focus();
		return false;
	}
	
	if(document.Cadastro.anuncioEnderecoBairro.value == "")
	{
		document.getElementById('bairro').innerHTML='<font color=red >Bairro:</font>';
		alert('Digite campo bairro');
		document.Cadastro.anuncioEnderecoBairro.focus();
		return false;
	}	
	
	if(document.Cadastro.uf.selectedIndex == 0)
	{
		document.getElementById('estado').innerHTML='<font color=red >Estado:</font>';
		alert('Selecione seu estado');
		document.Cadastro.uf.focus();
		return false;
	}
	
	if(document.Cadastro.city.selectedIndex == 0)
	{
		document.getElementById('cidade').innerHTML='<font color=red >Cidade:</font>';
		alert('Selecione sua cidade');
		document.Cadastro.city.focus();
		return false;
	}	
	
	
	if(document.Cadastro.anuncioEnderecoCep.value == "")
	{
		document.getElementById('cep').innerHTML='<font color=red >Cep:</font>';
		alert('Digite Cep');
		document.Cadastro.anuncioEnderecoCep.focus();
		return false;
	}	
	
	if(document.Cadastro.anuncioEnderecoCep2.value == "")
	{
		document.getElementById('cep').innerHTML='<font color=red >Cep:</font>';
		alert('Digite Cep');
		document.Cadastro.anuncioEnderecoCep2.focus();
		return false;
	}	
	
	if(document.Cadastro.anuncioTelefoneDDD.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite DDD do Telefone');
		document.Cadastro.anuncioTelefoneDDD.focus();
		return false;
	}		
	
	
	
	
	if(document.Cadastro.anuncioTelefoneNumero.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite o Telefone');
		document.Cadastro.anuncioTelefoneNumero.focus();
		return false;
	}

	
}
}












function ValidaAnuncioGratis()
{	


	if(document.Cadastro.anuncioCategoria.selectedIndex == 0)
	{
		document.getElementById('categoria').innerHTML='<font color=red >Categoria:</font>';
		alert('Selecione categoria');
		document.Cadastro.anuncioCategoria.focus();
		return false;
	}	
		

		
	var indice = document.Cadastro.anuncioCategoria.selectedIndex;
	var opindice = document.Cadastro.anuncioCategoria.options[indice].value;
	
	var indice2 = document.Cadastro.anuncioSubCategoria.selectedIndex;
	var opindice2 = document.Cadastro.anuncioSubCategoria.options[indice2].value;
	
		
	if(opindice == "new" && document.Cadastro.anuncioNewCategoria.value == "")
	{
		document.getElementById('newcategoria').innerHTML='<font color=red >Nova Categoria:</font>';
		alert('Digite nova categoria');
		document.Cadastro.anuncioNewCategoria.focus();
		return false;
	}	
	
	if(opindice2 == "new" && document.Cadastro.anuncioNewSubCategoria.value == "")
	{
		document.getElementById('newsubcategoria').innerHTML='<font color=red >Nova Sub Categoria:</font>';
		alert('Digite nova sub categoria');
		document.Cadastro.anuncioNewSubCategoria.focus();
		return false;
	}	
	
	
	if(document.Cadastro.anuncioSubCategoria.selectedIndex == 0)
	{
		document.getElementById('categoria').innerHTML='<font color=red >Sub Categoria:</font>';
		alert('Selecione sub categoria');
		document.Cadastro.anuncioSubCategoria.focus();
		return false;
	}	

	
	if(document.Cadastro.anuncioNome.value == "")
	{
		document.getElementById('nomeanuncio').innerHTML='<font color=red >Nome:</font>';
		alert('Digite campo nome de anúncio');
		document.Cadastro.anuncioNome.focus();
		return false;
	}

	
	
	if(document.Cadastro.anuncioTelefoneDDD.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite DDD do Telefone');
		document.Cadastro.anuncioTelefoneDDD.focus();
		return false;
	}		
	
	
	if(document.Cadastro.anuncioTelefoneNumero.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite o Telefone');
		document.Cadastro.anuncioTelefoneNumero.focus();
		return false;
	}	


}












function VoltaNormal(id,op)
{
	var texto;
	
	if(op == 1)
	texto = "Nova Sub Categoria:";
	if(op == 2)
	texto = "Telefone 2:";
	if(op == 3)
	texto = "Telefone Fax:";
	if(op == 4)
	texto = "Confirma Senha:";
	if(op == 5)
	texto = "Nova Categoria:";
	
	document.getElementById(id).innerHTML=texto;
}


function valida_EMAIL(campo) {
      var goodEmail = campo.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
      if (goodEmail) {
         return true;
      } else {
         return false;
      }
   }


function Confere()
{
// Confere se o CPF dado esta' OK
  if (document.Cadastro.usuarioCpf == "")
  {
    alert("Digite um valor para o campo \"CPF\".");
    document.Cadastro.usuarioCpf.focus();
  }	
   else
    {
	var result = "";
	var OK = false;
	var temp = Limpa(document.Cadastro.usuarioCpf.value);
    if (temp.length>10){
       var work=temp.substring(0,(temp.length)-2)
       var resto = Resto(work);
       OK = (resto==eval(temp.charAt((temp.length)-2)));
       if (OK){
          work=work+resto;
          resto= Resto(work);
          OK = (resto==eval(temp.charAt((temp.length)-1)));
       }
    }
    if (OK){
		result="CPF válido";
		}else{
			result="CPF inválido";
		}    
	if (OK)
		{
			document.getElementById('tipo').innerHTML='CPF:';
			document.Cadastro.usuarioNome.focus();
		}
		else
		{
		alert (result);
    	document.Cadastro.usuarioCpf.value = "";
		document.getElementById('tipo').innerHTML='<font color=red >CPF:</font>';
		document.Cadastro.usuarioCpf.focus();
		}
   }	
}

function Limpa(S){
//
// Deixa so' os digitos no numero
//
var Digitos = "0123456789";
var temp = "";
var digito = "";
    for (var i=0; i<S.length; i++){
      digito = S.charAt(i);
      if (Digitos.indexOf(digito)>=0){temp=temp+digito}
      }
   	  return temp
	  }
	  
	  
	  function Inverte(S){
//
// Inverte o string S
//
var temp="";
    for (var i=0; i<S.length; i++){
        temp=S.charAt(i)+temp
    }
    return temp
}

function Resto(S){
//
// Retorna o digito verificador (entrar com S "limpo")
//
var invertido = Inverte(Limpa(S));
var soma = 0;
    for (var i=0; i<invertido.length; i++){
        soma=soma+(i+2)*eval(invertido.charAt(i))
    }
    soma*=10;
// document.CPF.cpf.value=""; tirei para passar o cpf
    return ((soma % 11) % 10)
}


	


  function validaCNPJ() {
                 CNPJ = document.Cadastro.usuarioCNPJ.value;
                 erro = new String;
                 if (CNPJ.length < 18) erro += "É necessario preencher corretamente o número do CNPJ! "; 
                 if ((CNPJ.charAt(2) != ".") || (CNPJ.charAt(6) != ".") || (CNPJ.charAt(10) != "/") || (CNPJ.charAt(15) != "-")){
                 if (erro.length == 0) erro += "É necessário preencher corretamente o número do CNPJ! ";
                 }
                 //substituir os caracteres que não são números
               if(document.layers && parseInt(navigator.appVersion) == 4){
                       x = CNPJ.substring(0,2);
                       x += CNPJ. substring (3,6);
                       x += CNPJ. substring (7,10);
                       x += CNPJ. substring (11,15);
                       x += CNPJ. substring (16,18);
                       CNPJ = x; 
               } else {
                       CNPJ = CNPJ. replace (".","");
                       CNPJ = CNPJ. replace (".","");
                       CNPJ = CNPJ. replace ("-","");
                       CNPJ = CNPJ. replace ("/","");
               }
               var nonNumbers = /\D/;
               if (nonNumbers.test(CNPJ)) erro += "A verificação de CNPJ suporta apenas números! "; 
               var a = [];
               var b = new Number;
               var c = [6,5,4,3,2,9,8,7,6,5,4,3,2];
               for (i=0; i<12; i++){
                       a[i] = CNPJ.charAt(i);
                       b += a[i] * c[i+1];
 }
               if ((x = b % 11) < 2) { a[12] = 0 } else { a[12] = 11-x }
               b = 0;
               for (y=0; y<13; y++) {
                       b += (a[y] * c[y]); 
               }
               if ((x = b % 11) < 2) { a[13] = 0; } else { a[13] = 11-x; }
               if ((CNPJ.charAt(12) != a[12]) || (CNPJ.charAt(13) != a[13])){
                       erro +="Dígito verificador com problema!";
               }
               if (erro.length > 0){
                      alert(erro);
					  document.Cadastro.usuarioCNPJ.value = "";
					  document.Cadastro.usuarioCNPJ.focus();
				      document.getElementById('tipo').innerHTML='<font color=red >CNPJ:</font>';
                       return false;
               } else {
					   document.Cadastro.usuarioRazaoSocial.focus();
               }
               return true;
       }





function MenuAnuncio(op)
	{
			
			// document.getElementById('menufinanceiro').innerHTML='';
			// document.getElementById('noticia').innerHTML='';
			// document.getElementById('artigo').innerHTML='';
			// document.getElementById('menuanuncio').innerHTML='';
			 
			if(op == 1)
			document.getElementById('menuanuncio').innerHTML='<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=meusanuncios.php>Meus Anúncios</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=novoanuncio.php>Novo Anúncio</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=estatisticas2.php>Estatísticas</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=foto.php>Logotipo e Fotos</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=descricoes.php>Descrições</a></div></div>';
			
			//<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=minisite.php>Mini Site</a></div></div>
			
			if(op == 10)
			document.getElementById('menuanuncio').innerHTML='<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=meusanuncios.php>Meus Anúncios</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=novoanuncio.php>Novo Anúncio</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=estatisticas2.php>Estatísticas</a></div></div>';

			
			if(op == 2)
			document.getElementById('menufinanceiro').innerHTML='<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=boleto.php>Boleto</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=fatura.php>Fatura</a></div></div>';
			
			if(op == 3)
			document.getElementById('noticia').innerHTML='<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=minhasnoticias.php>Minhas Notícias</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=novanoticia.php>Nova Notícia</a></div></div>';
			
			if(op == 4)
			document.getElementById('artigo').innerHTML='<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=meusartigos.php>Meus Artigos</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=novoartigo.php>Novo Artigo</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=bannersartigos.php>Banners</a></div></div>';
			
			if(op == 5)
			document.getElementById('gata').innerHTML='<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=minhasgatas.php>Minhas Gatas</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=novagata.php>Nova Gata</a></div></div>';
			
			if(op == 6)
			document.getElementById('classificados').innerHTML='<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=meusclassificados.php>Meus Classificados</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=novoclassificado.php>Novo Classificado</a></div></div>';
			
			if(op == 7)
			document.getElementById('areadovendedor').innerHTML='<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=vendedor.php>Anúncios</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=vendedor.php?set=AnuncioNovo>Novo Anúncio</a></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=vendedor.php?set=AnuncioExpress>Novo Anúncio Express</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=vendedor.php?set=AnuncioFoto>Fotos</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=vendedor.php?set=AnuncioEstatistica>Estatísticas</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=vendedor.php?set=AnuncioDescricao>Descrições</a></div></div>';
			//<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=vendedor.php?set=Relatorio>Relatório</a></div>
			
			if(op == 8)
			document.getElementById('meusindicados').innerHTML='<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=indique_amigos.php>Indicar Amigos</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=meusindicados.php>Meus Indicados</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=ind_regulamento.php>Regulamento</a></div></div>';
			
			if(op == 9)
			document.getElementById('albumdefotos').innerHTML='<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=albumdefotos.php>Fotos Enviadas</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=novafoto.php>Nova Foto</a></div></div>';
			
			if(op == 11)
			document.getElementById('cadastrador').innerHTML='<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=cadastrador.php?set=Anuncios>Anúncios</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=cadastrador.php?set=AnuncioNovo>Novo Anúncio</a></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=cadastrador.php?set=AnuncioExpress>Novo Anúncio Express</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=cadastrador.php?set=AnuncioFoto>Fotos</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=cadastrador.php?set=AnuncioEstatistica>Estatísticas</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=cadastrador.php?set=AnuncioDescricao>Descrições</a></div></div>';
			
			if(op == 15)
			document.getElementById('blog').innerHTML='<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=meusposts.php>Meus Posts</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=novopost.php>Novo Post</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=alterardados.php?blog=1>Alterar Titulo</a></div></div>';
			
			if(op == 22)
			document.getElementById('sorteiro').innerHTML='<div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=meusnumeros.php>Meus Números</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=sorteio_premio.php>Prêmios</a></div></div><div style=\'width:145px; height:20px;\' align=\'right\'><div style=\'width:115px; height:20px;\' align=\'left\'><a href=sorteio_regulamento.php>Regulamento</a></div></div>';
			
	
}
	
	
	
function digamePropriedades(){ 
    var texto 
    texto = "O número de opções do select: " + document.formul.minhaSelect.length 
    var indice = document.formul.minhaSelect.selectedIndex 
    texto += "\nIndice da opção escolhida: " + indice 
    var valor = document.formul.minhaSelect.options[indice].value 
    texto += "\nValor da opção escolhida: " + valor 
    var textoEscolhido = document.formul.minhaSelect.options[indice].text 
    texto += "\nTexto da opção escolhida: " + textoEscolhido 
    alert(texto) 
}




function NovaCat()
{
	var ind = document.Cadastro.anuncioCategoria.selectedIndex;
	var indvalue = document.Cadastro.anuncioCategoria.options[ind].value;
	var indsub = document.Cadastro.anuncioSubCategoria.selectedIndex;
	var indvaluesub = document.Cadastro.anuncioSubCategoria.options[indsub].value;

	
	if(indvalue == 'new')
	{
	
		if(indvaluesub != 'new')
		{
			//document.getElementById('anuncioSubCategoria').innerHTML='<font color=red >Sub Categoria:</font>';
			alert('Necessario criar uma nova Sub Categoria');
			document.getElementById('anuncioSubCategoria').selectedIndex=0;
		//	document.Cadastro.anuncioSubCategoria.focus();
			//return false;
		}	
	}
}

function keysAddress ()
{
	var ctrl=window.event.ctrlKey;
	var tecla=window.event.keyCode; 
	
   if ( navigator.appName != "Netscape" ) 
   {
      if ( ( window.event.keyCode >= 48 && window.event.keyCode <= 57 ))
	  {
         window.event.keyCode = window.event.keyCode;
      } 
	  else 
	  {
         window.event.keyCode = "";
      }
   }
   

   
}


function keysAddress2 ()
{
	var ctrl=window.event.ctrlKey;
	var tecla=window.event.keyCode; 
	
   if ( navigator.appName != "Netscape" ) 
   {
      if ( ( window.event.keyCode >= 48 && window.event.keyCode <= 57 ))
	  {
         window.event.keyCode = window.event.keyCode;
      } 
	  else 
	  {
         window.event.keyCode = "";
      }
   }

   
}


function keysAddress0 ()
{
	var ctrl=window.event.ctrlKey;
	var tecla=window.event.keyCode; 
	
   if ( navigator.appName != "Netscape" ) 
   {
      if ( ( window.event.keyCode >= 48 && window.event.keyCode <= 57 ))
	  {
         window.event.keyCode = window.event.keyCode;
      } 
	  else 
	  {
         window.event.keyCode = "";
      }
   }
  
   
}


function keysAddressExpress ()
{
	var ctrl=window.event.ctrlKey;
	var tecla=window.event.keyCode; 
	
   if ( navigator.appName != "Netscape" ) 
   {
      if ( ( window.event.keyCode >= 48 && window.event.keyCode <= 57 ))
	  {
         window.event.keyCode = window.event.keyCode;
      } 
	  else 
	  {
         window.event.keyCode = "";
      }
   }
   
   if(document.Cadastro.anuncioTelefoneDDD.value.length == 2)
      document.Cadastro.anuncioTelefoneNumero.focus();
   
   if(document.Cadastro.anuncioTelefoneNumero.value.length == 8)
   {
       document.Cadastro.submit();
   }
		


   
}



function ValidaNovaCategoria()
{	

		if(document.Alterar.categoriaNome.selectedIndex == 0)
		{
			alert('Selecione Categoria');
			document.Alterar.categoriaNome.focus();
			return false;
		}

}

function ValidaNovaSubCategoria()
{	

		if(document.Alterar.categoriaID.selectedIndex == 0)
		{
			alert('Selecione Categoria');
			document.Alterar.categoriaID.focus();
			return false;
		}

}







function keysAddressNome ()
{
	var ctrl=window.event.ctrlKey;
	var tecla=window.event.keyCode; 
	
   if ( navigator.appName != "Netscape" ) 
   {
      if ( ( window.event.keyCode >= 97 && window.event.keyCode <= 122 ) || ( window.event.keyCode >= 48 && window.event.keyCode <= 57 ) || window.event.keyCode == 45 || window.event.keyCode == 95)
	  {
         window.event.keyCode = window.event.keyCode;
      } 
	  else 
	  {
         window.event.keyCode = "";
      }
   }
}
	

function VerificarNome() 
{

var ctrl=window.event.ctrlKey;
var tecla=window.event.keyCode; 
if (ctrl && tecla==67)
{
	event.keyCode=0;
	event.returnValue=false;
}
if (ctrl && tecla==86) 
{
	event.keyCode=0;
	event.returnValue=false;
}


}


function ConfirmaDeletar()
{
		if(confirm("Você deseja realmente deletar?"))
		{
			return true;
		}
		else
		{
			return false;
		}
}

function ConfirmaRenovacao()
{
		if(confirm("Você deseja realmente renovar o classificado?"))
		{
			return true;
		}
		else
		{
			return false;
		}
}



function ValidaNoticia()
{	

		if(document.Cadastro.noticiaData.value == "")
		{
			document.getElementById('datanoticia').innerHTML='<font color=red >Data:</font>';
			alert('Digite a Data da Notícia');
			document.Cadastro.noticiaData.focus();
			return false;
		}
		
		if(document.Cadastro.noticiaHora.value == "")
		{
			document.getElementById('horanoticia').innerHTML='<font color=red >Hora:</font>';
			alert('Digite a Hora da Notícia');
			document.Cadastro.noticiaHora.focus();
			return false;
		}
		
		if(document.Cadastro.noticiaTitulo.value == "")
		{
			document.getElementById('titulonoticia').innerHTML='<font color=red >Titulo:</font>';
			alert('Digite Titulo da Notícia');
			document.Cadastro.noticiaTitulo.focus();
			return false;
		}
		
		if(document.Cadastro.noticiaTexto.value == "")
		{
			document.getElementById('textonoticia').innerHTML='<font color=red >Notícia:</font>';
			alert('Digite a Notícia');
			document.Cadastro.noticiaTexto.focus();
			return false;
		}

}


function ValidaClassificado()
{	

		if(document.Cadastro.classificadoCategoria.selectedIndex == 0)
		{
			document.getElementById('categoria').innerHTML='<font color=red >Categoria:</font>';
			alert('Selecione a categoria');
			document.Cadastro.classificadoCategoria.focus();
			return false;
		}
		
		if(document.Cadastro.classificadoNome.value == "")
		{
			document.getElementById('nomeclassificado').innerHTML='<font color=red >Nome:</font>';
			alert('Digite Nome do Classificado');
			document.Cadastro.classificadoNome.focus();
			return false;
		}
		
		if(document.Cadastro.classificadoValor.value == "")
		{
			document.getElementById('valorclassificado').innerHTML='<font color=red >Valor:</font>';
			alert('Digite Valor do Classificado');
			document.Cadastro.classificadoValor.focus();
			return false;
		}
		
				if(document.Cadastro.classificadoObservacoes.value == "")
		{
			document.getElementById('obsclassificado').innerHTML='<font color=red >Observações:</font>';
			alert('Digite Observações do Classificado');
			document.Cadastro.classificadoObservacoes.focus();
			return false;
		}
		

}



function ValidaArtigo()
{	

		if(document.Foto.artigoCategoria.selectedIndex == 0)
		{
			document.getElementById('artigocategoria').innerHTML='<font color=red >Categoria:</font>';
			alert('Selecione categoria');
			document.Foto.artigoCategoria.focus();
			return false;
		}
		
		if(document.Foto.artigoTitulo.value == "")
		{
			document.getElementById('tituloartigo').innerHTML='<font color=red >Hora:</font>';
			alert('Digite Titulo do Artigo');
			document.Foto.artigoTitulo.focus();
			return false;
		}
		
		if(document.Foto.artigoSintese.value == "")
		{
			document.getElementById('artigosintese').innerHTML='<font color=red >Síntese:</font>';
			alert('Digite síntese do artigo');
			document.Foto.artigoSintese.focus();
			return false;
		}
		
	
}


function ValidaBannerArtigo()
{	

		
		if(document.Foto.bannerCampanha.value == "")
		{
			alert('Digite o nome da companha!');
			document.Foto.bannerCampanha.focus();
			return false;
		}
		
		if(document.Foto.foto.value == "")
		{
			alert('Selecione uma imagem para a campanha!');
			document.Foto.foto.focus();
			return false;
		}
		
	
}


function ValidaGata()
{	

		
		if(document.Alterar.gataNome.value == "")
		{
			document.getElementById('nomegata').innerHTML='<font color=red >Nome:</font>';
			alert('Digite o nome da gata');
			document.Alterar.gataNome.focus();
			return false;
		}
		
		if(document.Alterar.gataDatadeNascimento.value == "")
		{
			document.getElementById('datan').innerHTML='<font color=red >Data de Nascimento:</font>';
			alert('Digite data de nascimento');
			document.Alterar.gataDatadeNascimento.focus();
			return false;
		}
		
		if(document.Alterar.gataEstadoCivil.value == "")
		{
			document.getElementById('estadocivil').innerHTML='<font color=red >Estado Civil:</font>';
			alert('Digite estado civil');
			document.Alterar.gataEstadoCivil.focus();
			return false;
		}
		
		if(document.Alterar.gataComentario.value == "")
		{
			document.getElementById('comentario').innerHTML='<font color=red >Comentários:</font>';
			alert('Digite comentário sobre a gata '+document.Alterar.gataNome.value);
			document.Alterar.gataComentario.focus();
			return false;
		}
		

}



function ValidaCadastroGata()
{	

		
		if(document.Foto.gataNome.value == "")
		{
			document.getElementById('nomegata').innerHTML='<font color=red >Nome:</font>';
			alert('Digite o nome da gata');
			document.Foto.gataNome.focus();
			return false;
		}
		
		if(document.Foto.gataDatadeNascimento.value == "")
		{
			document.getElementById('datan').innerHTML='<font color=red >Data de Nascimento:</font>';
			alert('Digite data de nascimento');
			document.Foto.gataDatadeNascimento.focus();
			return false;
		}
		
		if(document.Foto.gataEstadoCivil.value == "")
		{
			document.getElementById('estadocivil').innerHTML='<font color=red >Estado Civil:</font>';
			alert('Digite estado civil');
			document.Foto.gataEstadoCivil.focus();
			return false;
		}
		
		if(document.Foto.gataComentario.value == "")
		{
			document.getElementById('comentario').innerHTML='<font color=red >Comentários:</font>';
			alert('Digite comentário sobre a gata '+document.Foto.gataNome.value);
			document.Foto.gataComentario.focus();
			return false;
		}
		
		if(document.Foto.foto.value == "")
		{
			alert('Escolha uma foto');
			document.Foto.foto.focus();
			return false;
		}
		
	
}


function abre(url, width, height)

    {

        window.open(url,'_blank','resizable=no,toolbar=no,status=no,menubar=no,scrollbars=no,width=' + width + ',height=' + height)


    }
	
//o parâmentro form é o formulario em questão e t é um booleano 
  function ticar(form, t)
  { 
      campos = form.elements; 
      for (x=0; x<campos.length; x++) 
      if (campos[x].type == "checkbox")
	  campos[x].checked = t; 
  } 
  
  
  
function checkName(nome){
	if (nome.value != ''){
	nome_u = nome.value.search(new RegExp("^[a-záéíóúçãõüêîôûÁÉÍÓÚÃÔÊÔÛA-Z0-9]+([ ]+[a-záéíóúçãõüêîôûÁÉÍÓÚÃÔÊÔÛA-Z0-9]+)+"));
		if (nome_u < 0){
		alert("Nome inválido. Altere usando no mínimo um nome e um sobrenome.");
		nome_valido = false;
		document.Cadastro.usuarioNome.focus();
		} else {
		nome_valido = true;
		}
	}
}


function ValidaContato()
{
	
	if(document.Enviar.faleconoscoNome.value == "")
	{
		alert('Digite seu nome!');
		document.Foto.faleconoscoNome.focus();
		return false;
	}
	
	if(document.Enviar.faleconoscoAssunto.value == "")
	{
		alert('Digite o assunto!');
		document.Foto.faleconoscoAssunto.focus();
		return false;
	}
	
	if(document.Enviar.faleconoscoMessagem.value == "")
	{
		alert('Digite a mensagem!');
		document.Foto.faleconoscoMessagem.focus();
		return false;
	}
	
}




function ValidaAnuncioPagoAlterar()
{	


	
	if(document.Cadastro.anuncioNome.value == "")
	{
		document.getElementById('nomeanuncio').innerHTML='<font color=red >Nome:</font>';
		alert('Digite campo nome de anúncio');
		document.Cadastro.anuncioNome.focus();
		return false;
	}
	
	
	if(document.Cadastro.anuncioEmail.value)
	{
		
		if(!valida_EMAIL(document.Cadastro.anuncioEmail.value))
		{
			document.getElementById('emailanuncio').innerHTML='<font color=red >E-mail:</font>';
			alert('Digite E-mail Válido para o Anuncio');
			document.Cadastro.anuncioEmail.focus();
			return false;	
		}
		
	}
	
	
	
	
	if(document.Cadastro.anuncioDescricao.value == "")
	{
		document.getElementById('descricao').innerHTML='<font color=red >Descrição:</font>';
		alert('Digite Descrição do anúncio');
		document.Cadastro.anuncioDescricao.focus();
		return false;
	}
	
	
	if(document.Cadastro.anuncioLogin.value == "")
	{
		alert('Digite Endereço do anúncio');
		document.Cadastro.anuncioLogin.focus();
		return false;
	}
	
	if(document.Cadastro.anuncioDescricao.value == "")
	{
		document.getElementById('descricao').innerHTML='<font color=red >Descrição:</font>';
		alert('Digite Descrição do anúncio');
		document.Cadastro.anuncioDescricao.focus();
		return false;
	}

	
	if(document.Cadastro.anuncioNome.value == "")
	{
		document.getElementById('nomeanuncio').innerHTML='<font color=red >Nome:</font>';
		alert('Digite campo nome de anúncio');
		document.Cadastro.anuncioNome.focus();
		return false;
	}
	
	
		if(document.Cadastro.anuncioEmail.value == "")
	{
		document.getElementById('emailanuncio').innerHTML='<font color=red >E-mail:</font>';
		alert('Digite Email do Anuncio');
		document.Cadastro.anuncioEmail.focus();
		return false;
	}	
	else
	{
		
		if(!valida_EMAIL(document.Cadastro.anuncioEmail.value))
		{
			document.getElementById('emailanuncio').innerHTML='<font color=red >E-mail:</font>';
			alert('Digite E-mail Válido para o Anuncio');
			document.Cadastro.anuncioEmail.focus();
			return false;	
		}
		

	}
	
	if(document.Cadastro.anuncioEndereco.value == "")
	{
		document.getElementById('endereco').innerHTML='<font color=red >Endereço:</font>';
		alert('Digite campo endereço');
		document.Cadastro.anuncioEndereco.focus();
		return false;
	}

	if(document.Cadastro.anuncioEnderecoNumero.value == "")
	{
		alert('Digite campo número');
		document.Cadastro.anuncioEnderecoNumero.focus();
		return false;
	}
	
	if(document.Cadastro.anuncioEnderecoBairro.value == "")
	{
		document.getElementById('bairro').innerHTML='<font color=red >Bairro:</font>';
		alert('Digite campo bairro');
		document.Cadastro.anuncioEnderecoBairro.focus();
		return false;
	}	
	
	if(document.Cadastro.uf.selectedIndex == 0)
	{
		document.getElementById('estado').innerHTML='<font color=red >Estado:</font>';
		alert('Selecione seu estado');
		document.Cadastro.uf.focus();
		return false;
	}
	
	if(document.Cadastro.city.selectedIndex == 0)
	{
		document.getElementById('cidade').innerHTML='<font color=red >Cidade:</font>';
		alert('Selecione sua cidade');
		document.Cadastro.city.focus();
		return false;
	}	
	
	
	if(document.Cadastro.anuncioEnderecoCep.value == "")
	{
		document.getElementById('cep').innerHTML='<font color=red >Cep:</font>';
		alert('Digite Cep');
		document.Cadastro.anuncioEnderecoCep.focus();
		return false;
	}	
	
	if(document.Cadastro.anuncioEnderecoCep2.value == "")
	{
		document.getElementById('cep').innerHTML='<font color=red >Cep:</font>';
		alert('Digite Cep');
		document.Cadastro.anuncioEnderecoCep2.focus();
		return false;
	}	
	
	if(document.Cadastro.anuncioTelefoneDDD.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite DDD do Telefone');
		document.Cadastro.anuncioTelefoneDDD.focus();
		return false;
	}		
	
	
	
	
	if(document.Cadastro.anuncioTelefoneNumero.value == "")
	{
		document.getElementById('telefone').innerHTML='<font color=red >Telefone:</font>';
		alert('Digite o Telefone');
		document.Cadastro.anuncioTelefoneNumero.focus();
		return false;
	}

}