function validar_cpf(theCPF)
{
if (theCPF.value == "")
{
alert("Campo inválido. É necessário informar o CPF ou CNPJ");
//theCPF.focus();
return false;
}
if (((theCPF.value.length == 11) && (theCPF.value == 11111111111) || (theCPF.value == 22222222222) || (theCPF.value == 33333333333) || (theCPF.value == 44444444444) || (theCPF.value == 55555555555) || (theCPF.value == 66666666666) || (theCPF.value == 77777777777) || (theCPF.value == 88888888888) || (theCPF.value == 99999999999) || (theCPF.value == 00000000000)))
{
alert("CPF/CNPJ inválido.");
//theCPF.focus();
return false;
}
if (!((theCPF.value.length == 11) || (theCPF.value.length == 14)))
{
alert("CPF/CNPJ inválido.");
//theCPF.focus();
return false;
}
var checkOK = "0123456789";
var checkStr = theCPF.value;
var allValid = true;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
allNum += ch;
}
if (!allValid)
{
alert("Favor preencher somente com dígitos o campo CPF/CNPJ.");
//theCPF.focus();
return false;
}
var chkVal = allNum;
var prsVal = parseFloat(allNum);
if (chkVal != "" && !(prsVal > "0"))
{
alert("CPF zerado !");
//theCPF.focus();
return false;
}
if (theCPF.value.length == 11)
{
var tot = 0;
for (i = 2; i <= 10; i++)
tot += i * parseInt(checkStr.charAt(10 - i));
if ((tot * 10 % 11 % 10) != parseInt(checkStr.charAt(9)))
{
alert("CPF/CNPJ inválido.");
//theCPF.focus();
return false;
}
tot = 0;
for (i = 2; i <= 11; i++)
tot += i * parseInt(checkStr.charAt(11 - i));
if ((tot * 10 % 11 % 10) != parseInt(checkStr.charAt(10)))
{
alert("CPF/CNPJ inválido.");
//theCPF.focus();
return false;
}
}
else
{
var tot = 0;
var peso = 2;
for (i = 0; i <= 11; i++)
{
tot += peso * parseInt(checkStr.charAt(11 - i));
peso++;
if (peso == 10)
{
peso = 2;
}
}
if ((tot * 10 % 11 % 10) != parseInt(checkStr.charAt(12)))
{
alert("CPF/CNPJ inválido.");
//theCPF.focus();
return false;
}
tot = 0;
peso = 2;
for (i = 0; i <= 12; i++)
{
tot += peso * parseInt(checkStr.charAt(12 - i));
peso++;
if (peso == 10)
{
peso = 2;
}
}
if ((tot * 10 % 11 % 10) != parseInt(checkStr.charAt(13)))
{
alert("CPF/CNPJ inválido.");
//theCPF.focus();
return false;
}
}
return true;
}
function validar_dependente(){
if(document.getElementById("novo_creci").value==""){
alert('O campo CRECI está vazio!');
document.getElementById("novo_creci").focus();
return false;
}else if(document.getElementById("nome").value==""){
alert('O campo nome está vazio!');
document.getElementById("nome").focus();
return false;
}else if(!validar_cpf(document.getElementById("cpfcnpj"))){
document.getElementById("cpfcnpj").focus();
return false;
}else if(document.getElementById("email").value==""){
alert('O campo e-mail está vazio!');
document.getElementById("email").focus();
return false;
}else if(document.getElementById("telefone_comercial").value==""){
alert('O campo telefone está vazio!');
document.getElementById("telefone_comercial").focus();
return false;
}else{
return true;
}
}
function validar_assine(){
if(document.getElementById("nome").value==""){
alert('O campo nome está vazio!');
document.getElementById("nome").focus();
return false;
}else if(!validar_cpf(document.getElementById("cpfcnpj"))){
document.getElementById("cpfcnpj").focus();
return false;
}else if(document.getElementById("novo_creci").value==""){
alert('O campo CRECI está vazio!');
document.getElementById("novo_creci").focus();
return false;
}else if(document.getElementById("email").value==""){
alert('O campo e-mail está vazio!');
document.getElementById("email").focus();
return false;
}else if(document.getElementById("cep").value==""){
alert('O campo CEP está vazio!');
document.getElementById("cep").focus();
return false;
}else if(document.getElementById("bairro").value==""){
alert('O campo bairro está vazio!');
document.getElementById("bairro").focus();
return false;
}else if(document.getElementById("endereco").value==""){
alert('O campo endereço está vazio!');
document.getElementById("endereco").focus();
return false;
}else if(document.getElementById("telefone_comercial").value==""){
alert('O campo telefone está vazio!');
document.getElementById("telefone_comercial").focus();
return false;
}else if(document.getElementById("estado").value==""){
alert('O campo estado está vazio!');
document.getElementById("estado").focus();
return false;
}else if(document.getElementById("cidade").value==""){
alert('O campo cidade está vazio!');
document.getElementById("cidade").focus();
return false;
}else if(!document.getElementById("termo").checked){
alert('É necessário aceitar o termo para continuar!');
return false;
}else{
return true;
}
}
function validar_meusdados(){
if(document.getElementById("nome").value==""){
alert('O campo nome está vazio!');
document.getElementById("nome").focus();
return false;
}else if(document.getElementById("email").value==""){
alert('O campo e-mail está vazio!');
document.getElementById("email").focus();
return false;
}else if(document.getElementById("cep").value==""){
alert('O campo CEP está vazio!');
document.getElementById("cep").focus();
return false;
}else if(document.getElementById("bairro").value==""){
alert('O campo bairro está vazio!');
document.getElementById("bairro").focus();
return false;
}else if(document.getElementById("endereco").value==""){
alert('O campo endereço está vazio!');
document.getElementById("endereco").focus();
return false;
}else if(document.getElementById("telefone_comercial").value==""){
alert('O campo telefone está vazio!');
document.getElementById("telefone_comercial").focus();
return false;
}else if(document.getElementById("estado").value==""){
alert('O campo estado está vazio!');
document.getElementById("estado").focus();
return false;
}else if(document.getElementById("cidade").value==""){
alert('O campo cidade está vazio!');
document.getElementById("cidade").focus();
return false;
}else{
return true;
}
}
function validar_depoimento(){
if(document.getElementById("depoimento").value==""){
alert('O campo depoimento está vazio!');
document.getElementById("depoimento").focus();
return false;
}else{
return true;
}
}
function carregarBairros(id){
$.ajax({
type: "POST",
url: "/admin/ajax/imovelBairro.php",
data: "cidade="+id,
success: function(retorno){
$("select.bairro").html(retorno);
}
});
}
var stat = new Array("","","","");
var count = Math.round((Math.random()*stat.length));
var t;
var stat2 = new Array("","","","");
var count2 = Math.round((Math.random()*stat2.length));
var t2;
function timedCount(direction,bOnlyTimer){
var iTimerRefresh = 4000;
if (!bOnlyTimer) {
direction = direction || 1;
/* elementos (banners dos produtos) */
var elms = $("#promprod").children();
count += direction;
if(count > elms.length){
count=1;
}else if(count <= 0){
count=elms.length;
}
var bulls = $("#navbull").children().each(function(i) {
if (this.id == 'bull-bn0'+count) {
$(this).html('
');
}else{
$(this).html('
');
}
});
elms.hide();
$("#bn0" + count).fadeIn('slow');
iTimerRefresh = 9000;
}
t=setTimeout(function(){timedCount();},iTimerRefresh);
}
function timedCount2(direction,bOnlyTimer){
var iTimerRefresh = 4000;
if (!bOnlyTimer) {
direction = direction || 1;
/* elementos (banners dos produtos) */
var elms = $("#la_destaque").children();
count2 += direction;
if(count2 > elms.length){
count2=1;
}else if(count2 <= 0){
count2=elms.length;
}
var bulls = $("#la_pag").children().each(function(i) {
if (this.id == 'la-'+(count2-1)) {
$(this).html('
');
}else{
$(this).html('
');
}
});
elms.hide();
$("#la0" + count2).fadeIn('slow');
iTimerRefresh = 9000;
}
t2=setTimeout(function(){timedCount2();},iTimerRefresh);
}
function stopCount(){
clearTimeout(t)
}
function initBullets() {
$("#promprod").children().each(function(i) {
$("#navbull").append('
');
$("#bull-"+this.id).click(function(e){
count = parseFloat(this.id.replace(/^bull-bn/gi,''))-1;
e.preventDefault();
clearTimeout(t);
timedCount(1);
});
});
}
function initLanc(){
$("#la_destaque").children().each(function(i){
$("#la_pag").append('
');
$("#la-"+i).click(function(e){
count2 = i;
e.preventDefault();
clearTimeout(t2);
timedCount2(1);
});
})
}
$(document).ready(function(){
$(".ajax_indices").load("/site/includes/indices.php");
/* eventos prev next
$("#prev a").click(function(e){
e.preventDefault();
clearTimeout(t);
timedCount(-1)
})
$("#next a").click(function(e){
e.preventDefault();
clearTimeout(t);
timedCount(1)
})*/
$("#promprod a span").mouseover(function(e){
e.preventDefault();
clearTimeout(t);
})
$("#promprod a span").mouseout(function(e){
timedCount(1,true);
})
initBullets();
timedCount();
initLanc();
timedCount2();
$("#telefone_comercial,#telefone_celular").mask("(99)9999-9999");
$("#cep").mask("99999-999");
$('.bubbleInfo').each(function () {
var distance = 10;
var time = 250;
var hideDelay = 500;
var hideDelayTimer = null;
var beingShown = false;
var shown = false;
var trigger = $('.trigger', this);
var info = $('.popup', this).css('opacity', 0);
$([trigger.get(0), info.get(0)]).mouseover(function () {
if (hideDelayTimer) clearTimeout(hideDelayTimer);
if (beingShown || shown) {
// don't trigger the animation again
return;
} else {
// reset position of info box
beingShown = true;
info.css({
top: -80,
left: -35,
display: 'block'
}).animate({
top: '-=' + distance + 'px',
opacity: 1
}, time, 'swing', function() {
beingShown = false;
shown = true;
});
}
return false;
}).mouseout(function () {
if (hideDelayTimer) clearTimeout(hideDelayTimer);
hideDelayTimer = setTimeout(function () {
hideDelayTimer = null;
info.animate({
top: '-=' + distance + 'px',
opacity: 0
}, time, 'swing', function () {
shown = false;
info.css('display', 'none');
});
}, hideDelay);
return false;
});
});
});
function carregarCidades(estado,cidade){
$.ajax({
type: "POST",
url: "/admin/ajax/imovelCidade.php",
data: "estado="+estado+"&cidade="+cidade,
success: function(retorno){
$("select.cidades").html(retorno);
}
});
}
function favorito(op, id){
$.ajax({
type: "POST",
url: "/admin/ajax/imovelFavorito.php",
data: "fav="+op+"&id="+id,
success: function(retorno){
$("td.remover").html(retorno);
}
});
}
/* -- abas - INICIO -- */
function stAba(menu,conteudo)
{
this.menu = menu;
this.conteudo = conteudo;
}
var arAbas = new Array();
arAbas[0] = new stAba('tababas','evabas');
arAbas[1] = new stAba('tababas2','evabas2');
//arAbas[2] = new stAba('tababas3','evabas3');
arAbas[2] = new stAba('tababas4','evabas4');
function AlternarAbas(menu,conteudo,address)
{
for (i=0;i';
}
}
/* -- abas - FIM -- */