// ***** AJAX ****************************************************************
function addOption(selectId, txt, val, selected)
{
// Write your own safari browser detection
/*
if(safari) {
var element = document.getElementById(selectId);
var newone = new Option(txt,val,selected);
element.add(newone,element.options[element.options.length]);
} else {
*/
var objOption = new Option(txt, val, selected);
document.getElementById(selectId).options.add(objOption);
// }
}
//****************************************************************************
function MostraAviso(){
Top_atual = parent.document.getElementById('comunica').style.top;
Top_atual = Top_atual.replace('px','');
Top_atual = parseInt(Top_atual);
parent.document.getElementById('comunica').style.top=(Top_atual + 2);
if (Top_atual < 45) {
setTimeout('MostraAviso()',5);
} else {
parent.document.getElementById('comunica').focus();
window.focus();
}
}
function OcultaAviso(){
parent.document.getElementById('comunica').style.top=-150;
parent.document.getElementById('aviso').innerHTML = '';
}
function MostraMsg(Nm_campo) {
parent.document.getElementById(Nm_campo).style.visibility='visible';
}
function OcultaMsg(Nm_campo) {
parent.document.getElementById(Nm_campo).style.visibility='hidden';
parent.document.getElementById(Nm_campo+'_txt').style.visibility='hidden';
}
function OcultaFormNovoMsg(Nm_campo) {
parent.document.getElementById(Nm_campo).style.visibility='hidden';
parent.document.getElementById(Nm_campo+'_txt').style.visibility='hidden';
parent.document.getElementById(Nm_campo+'_contexto').style.visibility='hidden';
parent.document.getElementById(Nm_campo+'_perfil').style.visibility='hidden';
parent.document.getElementById(Nm_campo+'_tit').style.visibility='hidden';
parent.document.getElementById(Nm_campo+'_fecha').style.visibility='hidden';
}
function Adiciona_pred(campo_msg,dono,cod) {
MostraMsg(campo_msg);
parent.document.getElementById(campo_msg).innerHTML = '
Aguarde...
';
xajax_Adiciona_pred(campo_msg,dono,cod);
}
function Bloquear(campo_msg,dono,cod) {
MostraMsg(campo_msg);
parent.document.getElementById(campo_msg).innerHTML = '
Aguarde...
';
xajax_Bloquear(campo_msg,dono,cod);
}
function Jetmail(campo_msg,dono,cod) {
MostraMsg(campo_msg);
parent.document.getElementById(campo_msg).innerHTML = '
Aguarde...
';
xajax_Jetmail(campo_msg,dono,cod);
}
function FormNovaMsg(campo_msg,dono,cod) {
MostraMsg(campo_msg);
parent.document.getElementById(campo_msg).innerHTML = '
Aguarde...
';
xajax_FormNovaMsg(campo_msg,dono,cod);
}
function DesativarFormNovaMsg() {
if (checar_form('form_mail','Para enviar a mensagem, os campos devem estar preenchidos.') == true) {
document.forms['form_mail'].elements['enviar'].value = 'Aguarde...';
document.forms['form_mail'].elements['enviar'].disabled = true;
document.forms['form_mail'].submit();
}
}
function MsgSucesso(campo_msg) {
OcultaFormNovoMsg(campo_msg);
parent.document.getElementById(campo_msg).innerHTML = '
Sua mensagem foi enviada
com sucesso! ';
}
function MsgFalha(campo_msg) {
OcultaFormNovoMsg(campo_msg);
DimensionaDiv(campo_msg, 240);
parent.document.getElementById(campo_msg).innerHTML = '
Não foi possivel entregar sua mensagem,
tente novamente. ';
}
function FormJetMail(campo_msg,cod) {
MostraMsg(campo_msg);
DimensionaDiv(campo_msg, 240);
parent.document.getElementById(campo_msg).innerHTML = '
Aguarde...
';
xajax_FormJetMail(campo_msg,cod);
}
function GravaJetMail(campo_msg) {
if (checar_form('form_jet','Para salvar, os campos devem estar preenchidos.') == true) {
document.forms['form_jet'].elements['enviar'].value = 'Aguarde...';
document.forms['form_jet'].elements['enviar'].disabled = true;
xajax_GravaJetMail(campo_msg,document.forms['form_jet'].elements['assunto'].value,document.forms['form_jet'].elements['msg'].value);
}
}
function JetSucesso(campo_msg) {
OcultaFormNovoMsg(campo_msg);
DimensionaDiv(campo_msg, 240);
parent.document.getElementById(campo_msg).innerHTML = '
Seu Jet-mail foi gravado com sucesso!
Agora você ja pode enviar seu Jet-mail. ';
}
function JetFalha(campo_msg) {
OcultaFormNovoMsg(campo_msg);
DimensionaDiv(campo_msg, 240);
parent.document.getElementById(campo_msg).innerHTML = '
Não foi possível gravar seu Jet-mail,
tente novamente. ';
}
function FotoExtra(campo_msg,dono,cod) {
MostraMsg(campo_msg);
parent.document.getElementById(campo_msg).innerHTML = '
Aguarde...
';
xajax_FotoExtra(campo_msg,dono,cod);
}
function DimensionaDiv(campo_msg,tam) {
parent.document.getElementById(campo_msg).style.height = tam+'px';
}
function VerVideo(campo_msg,dono,cod) {
MostraMsg(campo_msg);
parent.document.getElementById(campo_msg).innerHTML = '
Aguarde...
';
xajax_VerVideo(campo_msg,dono,cod);
}
function addSWF (URL, WIDTH, HEIGHT, TRANSPARENT) {
document.write (' ');
}
//** funções para Array
function CriaArray (n) {
this.length = n
for (var i = 1 ; i <= n ; i++) {
this[i] = "";
}
}
//***********************
var ok = false;
function Seleciona_checkbox(f) {
if(!ok){
for (var i=0; i max) {
Nm_campo = campo + clicado;
document.forms[form].elements[Nm_campo].checked = false;
alert('No máximo ' + max + " opções!");
}
}
function Tanto_faz(form, campo, qt, clicado) {
Nm_campo_ativo = campo + clicado;
if ((clicado == 0) && (document.forms[form].elements[Nm_campo_ativo].checked == true)) {
for (I = 1; I < qt; I++) {
Nm_campo = campo + I
document.forms[form].elements[Nm_campo].checked = false;
document.forms[form].elements[Nm_campo].disabled = true;
}
}
else {
for (I = 1; I < qt; I++) {
Nm_campo = campo + I
document.forms[form].elements[Nm_campo].disabled = false;
}
}
}
function foto(form, i, f, m) {
if (document.forms[form].elements[i].checked == true) {
document.forms[form].elements[f].checked = false;
}
}
function visib() {
if (document.forms['form_alt'].elements['preferencia'].checked == true) {
document.forms['form_alt'].elements['logado'].checked = true;
}
}
function visib2() {
if (document.forms['form_alt'].elements['logado'].checked == false) {
document.forms['form_alt'].elements['preferencia'].checked = false;
// document.forms['form_alt'].elements['estado'].checked = false;
}
}
function fncContador(obCampo, obCampoCaracter, nmLimite) {
if (obCampo.innerHTML.length >= eval(nmLimite)) {
obCampo.innerHTML = obCampo.innerHTML.substring(0,nmLimite);
}
obCampoCaracter.innerHTML = '(' + eval(obCampo.value.length) + ' de ' + nmLimite + ' caracteres)';
}
function limita(area_texto,max) {
if(area_texto.value.length>=max){
area_texto.value=area_texto.value.substring(0,max);
}
}
function Esconde(){
document.getElementById('banner').style.visibility="hidden";
}
function findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i
//******************************
// FUNÇÕES DE CAD
//******************************
function enviar_cad2() {
Campos = new CriaArray(19)
Campos[0] = document.forms['form_cad'].elements['frase_ap'].value ;
Campos[1] = document.forms['form_cad'].elements['apres_pes'].value ;
Campos[2] = document.forms['form_cad'].elements['est_civil'].value ;
campos = 4;
txt_procura = '';
for (I = 1; I <= campos; I++) {
nm_campo = 'procura'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt_procura != "") txt_procura += ':';
txt_procura += I;
}
}
Campos[3] = txt_procura;
Campos[4] = document.forms['form_cad'].elements['filhos'].value ;
Campos[5] = document.forms['form_cad'].elements['renda'].value ;
Campos[6] = document.forms['form_cad'].elements['formacao'].value ;
Campos[7] = document.forms['form_cad'].elements['altura'].value ;
Campos[8] = document.forms['form_cad'].elements['peso'].value ;
Campos[9] = document.forms['form_cad'].elements['fisico'].value ;
Campos[10] = document.forms['form_cad'].elements['pele'].value ;
Campos[11] = document.forms['form_cad'].elements['olhos'].value ;
Campos[12] = document.forms['form_cad'].elements['cabelo_cor'].value;
Campos[13] = document.forms['form_cad'].elements['cabelo_tp'].value;
Campos[14] = document.forms['form_cad'].elements['cabelo_vol'].value;
Campos[15] = document.forms['form_cad'].elements['bebida'].value;
Campos[16] = document.forms['form_cad'].elements['exercicio'].value;
Campos[17] = document.forms['form_cad'].elements['fumo'].value;
Campos[18] = document.forms['form_cad'].elements['codID'].value;
xajax_AvancaCad('2',Campos);
}
function enviar_cad3(codID) {
xajax_AvancaCad('3',codID);
}
function enviar_cad4(codID) {
xajax_AvancaCad('4',codID);
}
function enviar_cad5() {
Campos = new CriaArray(27)
Campos[0] = document.forms['form_cad'].elements['sexo'].value ;
Campos[1] = document.forms['form_cad'].elements['orient_sex'].value ;
Campos[2] = document.forms['form_cad'].elements['idade_min'].value ;
Campos[3] = document.forms['form_cad'].elements['idade_max'].value ;
Campos[4] = document.forms['form_cad'].elements['pais'].value ;
Campos[5] = document.forms['form_cad'].elements['cod_uf'].value ;
Campos[6] = document.forms['form_cad'].elements['cod_cidade'].value ;
campos = 4;
txt = '';
for (I = 0; I <= campos -1; I++) {
nm_campo = 'procura'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt != "") txt += ':';
txt += I;
}
}
Campos[7] = txt;
campos = 5;
txt = '';
for (I = 0; I <= campos -1; I++) {
nm_campo = 'est_civil'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt != "") txt += ':';
txt += I;
}
}
Campos[8] = txt;
campos = 3;
txt = '';
for (I = 0; I <= campos -1; I++) {
nm_campo = 'filhos'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt != "") txt += ':';
txt += I;
}
}
Campos[9] = txt;
campos = 7;
txt = '';
for (I = 0; I <= campos-1; I++) {
nm_campo = 'renda'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt != "") txt += ':';
txt += I;
}
}
Campos[10] = txt;
campos = 8;
txt = '';
for (I = 0; I <= campos-1; I++) {
nm_campo = 'formacao'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt != "") txt += ':';
txt += I;
}
}
Campos[11] = txt;
Campos[12] = document.forms['form_cad'].elements['alt_min'].value ;
Campos[13] = document.forms['form_cad'].elements['alt_max'].value ;
Campos[14] = document.forms['form_cad'].elements['peso_min'].value ;
Campos[15] = document.forms['form_cad'].elements['peso_max'].value ;
campos = 5;
txt = '';
for (I = 0; I <= campos-1; I++) {
nm_campo = 'tp_fisico'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt != "") txt += ':';
txt += I;
}
}
Campos[16] = txt;
campos = 11;
txt = '';
for (I = 0; I <= campos-1; I++) {
nm_campo = 'pele'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt != "") txt += ':';
txt += I;
}
}
Campos[17] = txt;
campos = 5;
txt = '';
for (I = 0; I <= campos-1; I++) {
nm_campo = 'olhos'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt != "") txt += ':';
txt += I;
}
}
Campos[18] = txt;
campos = 7;
txt = '';
for (I = 0; I <= campos-1; I++) {
nm_campo = 'cabelo_cor'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt != "") txt += ':';
txt += I;
}
}
Campos[19] = txt;
campos = 4;
txt = '';
for (I = 0; I <= campos-1; I++) {
nm_campo = 'cabelo_tp'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt != "") txt += ':';
txt += I;
}
}
Campos[20] = txt;
campos = 6;
txt = '';
for (I = 0; I <= campos-1; I++) {
nm_campo = 'cabelo_vol'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt != "") txt += ':';
txt += I;
}
}
Campos[21] = txt;
campos = 3;
txt = '';
for (I = 0; I <= campos-1; I++) {
nm_campo = 'bebida'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt != "") txt += ':';
txt += I;
}
}
Campos[22] = txt;
campos = 3;
txt = '';
for (I = 0; I <= campos-1; I++) {
nm_campo = 'exercicio'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt != "") txt += ':';
txt += I;
}
}
Campos[23] = txt;
campos = 3;
txt = '';
for (I = 0; I <= campos-1; I++) {
nm_campo = 'fumo'+I;
if (document.forms['form_cad'].elements[nm_campo].checked) {
if (txt != "") txt += ':';
txt += I;
}
}
Campos[24] = txt;
Campos[25] = document.forms['form_cad'].elements['um_pouco'].value ;
Campos[26] = document.forms['form_cad'].elements['codID'].value;
xajax_AvancaCad('5',Campos);
}
function enviar_cad6(codID, Install) {
xajax_AvancaCad('6',codID, Install);
}
function FinalCad(Install, codID) {
if (Install == 1) {
abre('pop_toolbar.php', 'pop_toolbar', 600,500);
//window.top.location.href="toolbar/toolbar_IE_namorando.exe";
enviar_cad6(codID, Install);
}
else {
enviar_cad6(codID, Install);
}
}
// *** Pagamentos ***
function isCreditCard(st){
if (st.length > 19) return false;
sum = 0; mul = 1; l = st.length;
for (i = 0; i < l; i++) {
digit = st.substring(l-i-1,l-i);
tproduct = parseInt(digit ,10)*mul;
if (tproduct >= 10) sum += (tproduct % 10) + 1; else sum += tproduct;
if (mul == 1) mul++; else mul--;
}
if ((sum % 10) == 0) return (true); else return (false);
}
function isVisa(cc){
if (((cc.length == 16) || (cc.length == 13)) && (cc.substring(0,1) == 4)) return isCreditCard(cc);
return false;
}
function isMasterCard(cc){
firstdig = cc.substring(0,1);
seconddig = cc.substring(1,2);
if ((cc.length == 16) && (firstdig == 5) && ((seconddig >= 1) && (seconddig <= 5))) return isCreditCard(cc);
return false;
}
function isAmericanExpress(cc){
firstdig = cc.substring(0,1);
seconddig = cc.substring(1,2);
if ((cc.length == 15) && (firstdig == 3) && ((seconddig == 4) || (seconddig == 7))) return isCreditCard(cc);
return false;
}
function isDinersClub(cc){
firstdig = cc.substring(0,1);
seconddig = cc.substring(1,2);
if ((cc.length == 14) && (firstdig == 3) && ((seconddig == 0) || (seconddig == 6) || (seconddig == 8))) return isCreditCard(cc);
return false;
}
function ValidaCartao(cc){
if(isVisa(cc)){
if (document.form_pagto.cartao.value != "Visa") return false;
return;
}
if(isMasterCard(cc)){
if (document.form_pagto.cartao.value != "Master") return false;
return;
}
if(isAmericanExpress(cc)){
if (document.form_pagto.cartao.value != "Amex") return false;
return;
}
if(isDinersClub(cc)){
if (document.form_pagto.cartao.value != "Master") return false;
return;
}
return false;
}
function valida_form() {
msg = "";
if (document.form_pagto.cartao.value == "") msg += "\n - Você não escolheu o seu cartão de crédito!";
if (document.form_pagto.numero.value == "") msg += "\n - Preencha o número do cartão de crédito!";
else {
if (ValidaCartao(document.form_pagto.numero.value) == false) msg += "\n - O número do cartão de Crédito é inválido!";
}
if (document.form_pagto.titular.value == "") msg += "\n - Nome do titular não preenchido!";
if (document.form_pagto.cod_seg.value == "") msg += "\n - Código de segurança não informado!";
else {
if (document.form_pagto.cod_seg.value.length < 3) msg += "\n - O código de segurança deve conter 3 digitos!";
}
if (document.form_pagto.mes.value == "") msg += "\n - Mes de expiração não preenchido!";
if (document.form_pagto.ano.value == "") msg += "\n - Ano de expiração não preenchido!";
if (document.form_pagto.mes.value != "" && document.form_pagto.ano.value != "") {
if (document.form_pagto.ano.value == 2008 && document.form_pagto.mes.value < 7)
msg += "\n - Este cartão já esta vencido!";
}
if (msg == "") {
xajax_Pagto2(document.form_pagto.local.value,document.form_pagto.ID_Usuario.value,document.form_pagto.cartao.value,document.form_pagto.numero.value,document.form_pagto.titular.value,document.form_pagto.cod_seg.value,document.form_pagto.mes.value,document.form_pagto.ano.value,document.form_pagto.valor.value);
} else alert("Os seguintes erros foram encontrados:\n " + msg);
}
//*******************