

// JavaScript Document
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->

function cormenu(objeto,cor){
	if (cor!=''){
		objeto.bgColor = cor;
		//objeto.className = 'fundomenu';
	}else{
		objeto.bgColor = '';
	}
}
function link(url){
	//alert(url);
	document.location = url;
}
function cumprimento(){
	data = new Date();
	//alert(data);
	hora = data.getHours();
	//alert(hora);
	if ((hora >= "6") && (hora < "12")){
		//alert("Bom Dia");
		texto = "Bom Dia ";
	}else{
		if ((hora>="12") && (hora<="18")) {
			//alert("Boa Tarde");
			texto = "Boa Tarde ";
		}else{
			texto = "Boa Noite ";
			//alert("Boa noite");
		}
	}
	tagcumprimento.innerHTML = texto;
}

function dataextensa(){
	hoje = new Date()
	dia = hoje.getDate()
	dias = hoje.getDay()
	mes = hoje.getMonth()
	ano = hoje.getYear()
	if (dia < 10)
	dia = "0" + dia
	if (ano < 2000)
	ano = "19" + ano
	function CriaArray (n) {
	this.length = n }
	NomeDia = new CriaArray(7)
	NomeDia[0] = "Domingo"
	NomeDia[1] = "Segunda-feira"
	NomeDia[2] = "Terça-feira"
	NomeDia[3] = "Quarta-feira"
	NomeDia[4] = "Quinta-feira"
	NomeDia[5] = "Sexta-feira"
	NomeDia[6] = "Sábado"
	//
	NomeMes = new CriaArray(12)
	NomeMes[0] = "Janeiro"
	NomeMes[1] = "Fevereiro"
	NomeMes[2] = "Março"
	NomeMes[3] = "Abril"
	NomeMes[4] = "Maio"
	NomeMes[5] = "Junho"
	NomeMes[6] = "Julho"
	NomeMes[7] = "Agosto"
	NomeMes[8] = "Setembro"
	NomeMes[9] = "Outubro"
	NomeMes[10] = "Novembro"
	NomeMes[11] = "Dezembro"
	
	data = NomeDia[dias] + ", " + dia + " de " + NomeMes[mes] + " de " + ano;
	tagData.innerHTML = data;
}
function executa(){
	cumprimento();
	//dataextensa();
}
function abrejanela(url,nome,parametros){
	window.open(url,nome,parametros);
}

function emailCheck (emailStr) {


//Verifica se o que foi digitado contém espaços e os retira.
re = / /gi
emailStr = emailStr.replace(re,"");
//----------------------------------------------------------


/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD.  1 means check it, 0 means don't. */

var checkTLD=1;

/* The following is the list of known TLDs that an e-mail address must end with. */

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

/* The following pattern is used to check if the entered e-mail address
fits the user@domain format.  It also is used to separate the username
from the domain. */

var emailPat=/^(.+)@(.+)$/;

/* The following string represents the pattern for matching all special
characters.  We don't want to allow special characters in the address. 
These characters include ( ) < > @ , ; : \ " . [ ] */

var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

/* The following string represents the range of characters allowed in a 
username or domainname.  It really states which chars aren't allowed.*/

var validChars="\[^\\s" + specialChars + "\]";

/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */

var quotedUser="(\"[^\"]*\")";

/* The following pattern applies for domains that are IP addresses,
rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

/* The following string represents an atom (basically a series of non-special characters.) */

var atom=validChars + '+';

/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */

var word="(" + atom + "|" + quotedUser + ")";

// The following pattern describes the structure of the user

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

/* Finally, let's start trying to figure out if the supplied address is valid. */

/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */

var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */

alert("Endereço de email incorreto!");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

// Start by checking that only basic ASCII characters are in the strings (0-127).

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Email contém caracteres invalidos!");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Email contém caracteres invalidos!");
return false;
   }
}

// See if "user" is valid 

if (user.match(userPat)==null) {

// user is not valid

alert("Endereço de email não é valido!");
return false;
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

// this is an IP address

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destino de endereço de IP invalido!");
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("Endereço de email não é valido!");
return false;
   }
}

/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding 
the domain or country. */

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("Endereço de email não é valido!");
return false;
}

// Make sure there's a host name preceding the domain.

if (len<2) {
alert("Esta faltando o nome do seu provedor!");
return false;
}

// If we've gotten this far, everything's valid!
return true;
}

//  End -->

function CadastraEnquete() {
var remote = null
remote = window.open('','enquete_','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,menubar=no,width=400,height=350');
}

function validaForm(doc) {
	if (doc.cookie_login.value == "") {
		alert("Favor preencher o campo Login!");
		doc.cookie_login.focus();	
		return false;
	}
	if (doc.cookie_senha.value == "") {
		alert("Favor preencher o campo Senha!");
		doc.cookie_senha.focus();	
		return false;
	}
}
function validaCadastro(){
	var form = document.formCadastro;
		if (form.cookie_login.value==""){
			alert("Favor preencher o campo Login");
			form.cookie_login.focus();
			return false;
		}else{
			if (form.cookie_login.value.length < 6) {
				alert("Mínimo de 6(seis) caracteres");
				form.cookie_login.focus();
				return false;
			}
		}
		if (form.cookie_senha.value==""){
			alert("Favor preencher o campo Senha");
			form.cookie_senha.focus();
			return false;
		}else{
			if (form.cookie_senha.value.length < 4) {
				alert("Mínimo de 4(quatro) caracteres");
				form.cookie_senha.focus();
				return false;
			}
		}
		if (form.cadastro_nome.value==""){
			alert("Favor preencher o campo Nome");
			form.cadastro_nome.focus();
			return false;
		}
		if (form.cadastro_email.value==""){
			alert("Favor preencher o campo Email");
			form.cadastro_email.focus();
			return false;
		}else{
			var resultado = emailCheck(form.cadastro_email.value);
			if (resultado==false){
				form.cadastro_email.focus();
				return false;
			}
		}
		if (form.cadastro_dia.value == 0){
			alert("Favor selecionar o dia do seu nascimento");
			return false;
		}
		if (form.cadastro_mes.value==0){
			alert("Selecione o mês do seu nascimento");
			return false;
		}
		if (form.cadastro_ano.value==0){
			alert("Favor selecionar o ano do seu nascimento");
			form.cadastro_ano.focus();
			return false;
		}
		if (form.sexo_id.value==0){
			alert("Selecione o sexo");
			return false;
		}
		if (form.regiao_id.value==0){
			alert("Selecione o seu Estado");
			return false;
		}
		if (form._profissao.value==""){
			alert("Selecione a sua Atividade");
			return false;
		}
		if (form.scholarship.value==0){
			alert("Selecione sua escolaridade");
			return false;
		}
		var cont=0;
		for(i=0;i<form.elements.length;i++){
		  	if(form.elements[i].name=="interesse"){
		    	if(form.elements[i].checked==true){
		        	++cont; 
		 		} 
			}
		}
		if(cont==0) {
			alert('Selecione pelo menos um interesse');
			return false;
		}else{
			return true; 
		}
}

function verificanumero(valor){
	if (valor.value!=""){
		if (isNaN(valor.value)){
			alert("Valor inválido!\nDigite Somente números");
			valor.value="";
		}
	}
}

function validabusca(objeto){
	if (objeto.value==""){
		alert("O campo busca não pode ficar vazio!");
		objeto.focus();
		return false;
	}else{
		return true;
	}
}
function doLoad() {
	var s1 = "<TITLE>Maisde50</TITLE>" +    
	"<BODY topmargin=0 leftmargin=0 magin=0>"
	var s2 = "<IMG SRC='"+this.src+"'></BODY>"
	popup = window.open("","","height="+this.height+",width="+this.width+",toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0")  
	popup.document.write(s1+s2)
}

function doError() {
	alert("Arquivo " + this.src + " não encontrado")
}

var i 

function LoadImage(src) {
	i = new Image
	i.onload = doLoad;
	i.onerror = doError;
	i.src = src
}

function checa_faleconosco(form){
	if (form.txtnome.value==""){
		alert("Informe o nome");
		form.txtnome.focus();
		return false;
	}
	if (form.txtemail.value==""){
		alert("Campo de email não pode ficar vazio");
		form.txtemail.focus();
		return false;
	}else{
		var resultado = emailCheck(form.txtemail.value);
		if (resultado==false){
			form.txtemail.focus();
			return false;
		}
	}
	if (form.slcnatureza.value==0){
		alert("Selecione a Natureza de Contato");
		return false;
	}
	if (form.txtmensagem.value==""){
		alert("O campo mensagem não pode ficar vazio");
		form.txtmensagem.focus();
		return false;
	}
}

function checa_forum(form){
	if (form.txtfrom.value==""){
		alert("Informe o seu nome");
		form.txtfrom.focus();
		return false;
	}
	if (form.txtemail.value==""){
		alert("Campo de email não pode ficar vazio");
		form.txtemail.focus();
		return false;
	}else{
		var resultado = emailCheck(form.txtemail.value);
		if (resultado==false){
			form.txtemail.focus();
			return false;
		}
	}

	if (form.txttitulo.value==""){
		alert("O campo titulo não pode ficar vazio");
		form.txttitulo.focus();
		return false;
	}

	if (form.txtmensagem.value==""){
		alert("O campo mensagem não pode ficar vazio");
		form.txtmensagem.focus();
		return false;
	}
	return true;
}

function move_menu(tabela) 
{
	nova_tabela = eval("top.document.all." + tabela);
	if(typeof nova_tabela == "object")
	{
		if(nova_tabela.style.display == "none")
		{
			nova_tabela.style.display = "block";
			nova_tabela.focus();
		}
		else
		{
			nova_tabela.style.display = "none";
		}		
	}	
}

function fecha_janela() {
	top.document.all.frmEsqueceu.src = 'esqueceu.asp';
	move_menu('divSenha');
}

function troca_image(){
	//alert("oi");
	if (document.all.spincluir.style.display=="block"){
		incluir.src = "images/classificados_voltar.gif";
	}else{
		incluir.src = "images/classificados_incluir.gif";
	}

}

function enviar(name){
	//alert(name);
	//alert("document."+name);
	var form = eval("document." + name);
	//alert(form.name);
	if(typeof nova_tabela == "object") {
		form.submit();
	}
}


function checa_cadastro(){
	var form = document.frmCadastro;
		if (form.login.value==""){
			alert("Favor preencher o campo Login");
			form.login.focus();
			return false;
		}else{
			if (form.login.value.length < 6) {
				alert("Mínimo de 6(seis) caracteres");
				form.login.focus();
				return false;
			}
		}
		if (form.senha.value==""){
			alert("Favor preencher o campo Senha");
			form.senha.focus();
			return false;
		}else{
			if (form.senha.value.length < 4) {
				alert("Mínimo de 4(quatro) caracteres");
				form.senha.focus();
				return false;
			}
		}
		if (form.confsenha.value==""){
			alert("Favor preencha a confirmação da Senha");
			form.confsenha.focus();
			return false;
		}else{
			if (form.confsenha.value.length < 4) {
				alert("Mínimo de 4(quatro) caracteres");
				form.confsenha.focus();
				return false;
			}
		}
		if (form.senha.value != form.confsenha.value){
			alert("A confirmação da senha tem que ser igual a senha");
			form.senha.value = "";
			form.confsenha.value = "";
			form.senha.focus();
			return false;
		}
		if (form.nome.value==""){
			alert("Favor preencher o campo Nome");
			form.nome.focus();
			return false;
		}
		if (form.email.value==""){
			alert("Favor preencher o campo Email");
			form.email.focus();
			return false;
		}else{
			var resultado = emailCheck(form.email.value);
			if (resultado==false){
				form.email.focus();
				return false;
			}
		}
		if (form.dia.value == 0){
			alert("Favor selecionar o dia do seu nascimento");
			return false;
		}
		if (form.mes.value==0){
			alert("Selecione o mês do seu nascimento");
			return false;
		}
		if (form.ano.value==0){
			alert("Favor selecionar o ano do seu nascimento");
			return false;
		}
		if (form.sexo.value==0){
			alert("Selecione o sexo");
			return false;
		}
		if (form.pais.value==0){
			alert("Selecione o seu Pais");
			return false;
		}
		if (form.estado.value==0){
			alert("Selecione o seu Estado");
			return false;
		}
		if (form.atividade.value==0){
			alert("Selecione a sua Atividade");
			return false;
		}
		if (form.escolaridade.value==0){
			alert("Selecione sua escolaridade");
			return false;
		}
		var cont=0;
		for(i=0;i<form.elements.length;i++){
		  	if(form.elements[i].name=="interesse"){
		    	if(form.elements[i].checked==true){
		        	++cont; 
		 		} 
			}
		}
		if(cont==0) {
			alert('Selecione pelo menos um interesse');
			return false;
		}else{
			return true; 
		}
}

function checa_login(form){
	//var form = document.frmLogin;

	if (form.txtlogin.value==""){
		alert("Preencha o campo login!");
		form.txtlogin.focus();
		return false;
	}
	if (form.txtsenha.value==""){
		alert("Preencha o campo senha!");
		form.txtsenha.focus();
		return false;
	}

}

function checa_idade(){
	form = document.frmBusca;
	if (form.idade_fim.value>0){
		if (form.idade_fim.value<form.idade_inicio.value){
			alert("A Idade final não pode ser menor que a data Inicial.");
			form.idade_fim.value = 0;
		}
	}
}

function valida_CPF(obj){
 s = obj.value;
 if (isNaN(s)) {
  return false;
 }
 var i;
 var c = s.substr(0,9);
 var dv = s.substr(9,2);
 var d1 = 0;
 for (i = 0; i < 9; i++) {
  d1 += c.charAt(i)*(10-i);
 }
 if (d1 == 0){
  return false;
 }         
    d1 = 11 - (d1 % 11);
    if (d1 > 9) d1 = 0;         
 if (dv.charAt(0) != d1) {
  return false;         
 }
 d1 *= 2;
 for (i = 0; i < 9; i++) {
  d1 += c.charAt(i)*(11-i);
 }
 d1 = 11 - (d1 % 11);
 if (d1 > 9) d1 = 0;
 if (dv.charAt(1) != d1) {
     return false;
    }
    return true;
}

function verificanumero(valor){
	if (valor.value!=""){
		if (isNaN(valor.value)){
			alert("Valor inválido!\nDigite Somente números");
			valor.value="";
			valor.focus();
		}
	}
}

function  finalizaCadastro(){
	if (document.pagamento.btnenviar.disabled == false) {
		document.pagamento.btnenviar.disabled = true;
	}else{
		document.pagamento.btnenviar.disabled = false;
	}
}

function dividevalor(valor){
		valor = valor.replace(",",".");
		duplo = valor/2;
		//alert(duplo);
		duplo = duplo.toString();
		triplo = valor/3;
		//alert(triplo);
		triplo = triplo.toString();
		avista.innerHTML= "de R$" + valor;
		duasvezes.innerHTML= "de R$" + duplo.substr(0,6);
		tresvezes.innerHTML= "de R$" + triplo.substr(0,6);
}


function checaform(){
	var form = document.pagamento;

	if (form.txtnome.value==""){
		alert("Favor preencher o campo Nome");
		form.txtnome.focus();
		return false;
	}

	if (form.txtnomecracha.value==""){
		alert("Favor preencher o campo Nome para o Cracha");
		form.txtnomecracha.focus();
		return false;
	}

	if (form.txtddd.value==""){
		alert("Preencha o DDD!");
		form.txtddd.focus();
			return false;
	}

	if (form.txttelefone.value==""){
		alert("Preencha o Telefone!");
		form.txttelefone.focus();
		return false;
	}

	if (form.txtemail.value==""){
		alert("Favor preencher o campo Email");
		form.txtemail.focus();
		return false;
	}else{
		var resultado = emailCheck(form.txtemail.value);
		if (resultado==false){
			form.txtemail.focus();
			return false;
		}
	}

	if (form.slcdia.value==0){
		alert("Selecione o dia do nascimento");
		return false;
	}

	if (form.slcmes.value==0){
		alert("Selecione o mês do nascimento");
		return false;
	}

	if (form.slcano.value==0){
		alert("Selecione o ano do nascimento");
		return false;
	}

	if (form.txtidentidade.value==""){
		alert("Preencha o número da identidade!");
		form.txtidentidade.focus();
		return false;
	}
	if (form.txtcpf.value==""){
		alert("Preencha o número do CPF!");
		form.txtcpf.focus();
		return false;
	}else{
		//alert(valida_CPF(form.txtcpf));
		if (valida_CPF(form.txtcpf)==false){
			alert("CPF Inválido!\nPreencha novamente.")
			form.txtcpf.focus();
			return false;
		}
	}

	if (form.txtendereco.value==""){
		alert("Preencha o endereço!")
		form.txtendereco.focus();
		return false;
	}

	if (form.txtbairro.value=="") {
		alert("Preencha o Bairro!");
		form.txtbairro.focus();
		return false;
	}

	if (form.txtcidade.value=="") {
		alert("Preencha a cidade!");
		form.txtcidade.focus();
		return false;
	}

	if (form.slcestado.value==0){
		alert("Selecione o Estado!");
		return false;
	}

	if (form.txtcep.value==""){
		alert("Preencha o campo CEP!");
		form.txtcep.focus();
		return false;
	}
	
	var cont = 0;
	for(i=0;i<=2;i++) {
		if (form.radplanos[i].checked==true){
			cont++;
		}
	}
	if (cont==0){
		alert("Escolha pelo menos um Plano!");
		return false;
	}
}

function envia_busca(){
	//alert("oi");
	form = document.frmBusca;

	if (parseInt(form.estado.value)==0){
		alert("É necessário selecionar um Estado");
		form.estado.focus();
		envia = false;
	}else{
		if (parseInt(form.idade_inicio.value)==0){
			alert("Selecione uma idade mínima para a busca");
			form.idade_inicio.focus();
			envia = false;
		}else{
			if (parseInt(form.idade_fim.value)==0){
				alert("Selecione uma idade máxima para a busca");
				form.idade_fim.focus();
				envia = false;
			}else{
				envia = true;
			}
		}
	}
	//alert(envia);
	if (envia==true) {
		form.submit();	
	}
}	  

function envia_busca_avc(){
	form = document.frmBusca;

	/*if (parseInt(form.estado.value)==0){
		alert("É necessário selecionar um Estado");
		form.estado.focus();
		envia = false;
	}else{*/
		if (parseInt(form.idade_inicio.value)==0){
			alert("Selecione uma idade mínima para a busca");
			form.idade_inicio.focus();
			envia = false;
		}else{
			if (parseInt(form.idade_fim.value)==0){
				alert("Selecione uma idade máxima para a busca");
				form.idade_fim.focus();
				envia = false;
			}else{
				envia = true;
			}
		}
	//}

	if (envia==true) {
		form.submit();	
	}
}	  


function mostragrupo(op){
	if(op == '1'){
		grupo.style.display = "block";
	}else{
		grupo.style.display = "none";
		document.pagamento.txtgrupo.value = "";
	}		
}
function mostraSaibamais(){
	if(saibamais.style.display == "none")	{
		saibamais.style.display = "block";
	}else{
		saibamais.style.display = "none";
	}
}

	function escreve(tipo,destino){
		destino = eval('document.all.'+destino);
		if (tipo=='1'){
			destino.innerHTML = 'Mande um aperto de mão';
		}else{
			if (tipo=='2'){
				destino.innerHTML = 'Mande um abraço';
			}else{
				if (tipo=='3'){
					destino.innerHTML = 'Mande um beijo no rosto';
				}else{
					if (tipo=='4'){
						destino.innerHTML = 'Mande um beijo na boca';
					}else{
						destino.innerHTML = '';
					}
				}
			}
		}
	}