function showPhotos(idObj,action){ var domDiv = document.getElementById(idObj) /*action = 1 mostra div com a listagem das fotos action = 0 esconde a div com a listagem das fotos */ switch(action){ case 0: domDiv.style.display = 'none' break case 1: domDiv.style.display = 'block' break default: break } } /*Checa o email*/ function isMail(string) { var reg = new RegExp('^([\.a-zA-Z0-9_-]+)@([\.a-zA-Z0-9_-]){1,}[\.]{1,1}[a-zA-Z]{2,3}$'); if (!reg.test(string)) return false; return true; } /*Fim Checa o email*/ /*Tira os espaços em branco*/ function trim(sString) { while (sString.substring(0,1) == ' ') { sString = sString.substring(1, sString.length); } while (sString.substring(sString.length-1, sString.length) == ' ') { sString = sString.substring(0,sString.length-1); } return sString; } /*Fim Tira os espaços em branco*/ /*Validação do formulário de contato*/ function checkFormFaleConosco(){ var form = document.getElementById('frContato'); if(trim(form.nome.value)==""){ alert('Campo Nome vazio!'); form.nome.focus(); return false; } if(trim(form.email.value)==""){ alert('Campo E-Mail vazio!'); form.email.focus(); return false; } else{ if(!isMail(form.email.value)){ alert('E-Mail inválido!'); form.email.focus(); return false; } } return true; } /*Fim Validação do formulário de contato*/ /*Limpa Formulário*/ function checkFormClear(){ var form = document.getElementById('frContato'); form.document.reset(); } /*Fim Limpa Formulário*/ /*Abre popup*/ function openSendWin_lago(id) { window.open('/neophoto_lago/send.php?id='+id, '', 'width=330, height=300, scrollbars=yes'); } function openSendWin_cases(id) { window.open('/neophoto_cases/send.php?id='+id, '', 'width=330, height=300, scrollbars=yes'); } /* */ function neophotoNavigate_lago(id) { ajaxSendRequest('imagem','../neophoto_lago/modal2.php?id='+id,null); } function neophotoNavigate_cases(id) { ajaxSendRequest('imagem','/neophoto_cases/modal2.php?id='+id,null); } function checkFormOrcamento(){ var form = document.getElementById('frPreorc'); var num = form.elements.length; var total = 5; if(trim(form.nome.value)==""){ alert('Campo Nome vazio!'); form.nome.focus(); return false; } if(trim(form.email.value)==""){ alert('Campo E-Mail vazio!'); form.email.focus(); return false; } else{ if(!isMail(form.email.value)){ alert('E-Mail inválido!'); form.email.focus(); return false; } } if(trim(form.cidade.value)==""){ alert('Campo Cidade vazio!'); form.cidade.focus(); return false; } if(trim(form.comprimento.value)==""){ alert('Campo Comprimento vazio!'); form.comprimento.focus(); return false; } if(trim(form.largura.value)==""){ alert('Campo Largura vazio!'); form.largura.focus(); return false; } if(trim(form.profundidade.value)==""){ alert('Campo Profundidade vazio!'); form.profundidade.focus(); return false; } //todos os campos de radio var cont = 0; var prim = false; for (var i = 0; i < num; i++) { if (form.elements[i].type == 'radio') { var radio = form.elements[i]; if (radio.checked == true){ cont++; if((radio.value == 'Grande quantidade') || (radio.value == 'Raramente')){ total = 5; } if((radio.value == 'Nao recebe queda de folhas')){ total = 4; //alert(form.elements[20].checked); form.elements[20].checked = false; form.elements[21].checked = false; } } } } //alert(cont); //alert(total); if(cont != total){ alert('Preencha todos os campos de opções de escolha, os campos obrigatórios possuem *'); return false; } //campos de check box var cont2 = 0; for (var i = 0; i < num; i++) { //alert(form.elements[i].type); if (form.elements[i].type == 'checkbox') { var checkbox = form.elements[i]; if (checkbox.checked == true){ cont2++; if(checkbox.value == 'outro'){ if(trim(form.especifique.value)==""){ alert('Você marcou o campo Outros, intão especifique o outro habitante!'); form.especifique.focus(); return false; } } } } } if(cont2 == 0){ alert('Preencha pela menos um dos campos de habitantes do lago!'); form.peixe.focus(); return false; } return true; } function habilitaArquivos() { document.getElementById("arquivo1").style.display = "none"; document.getElementById("arquivo2").style.display = "none"; document.getElementById("arquivo3").style.display = "none"; document.getElementById("arquivo4").style.display = "none"; document.getElementById("arquivo5").style.display = "none"; sel = document.getElementById('qtdeArquivo'); opcao = sel.options[sel.selectedIndex].value; if (opcao != "0") { switch (opcao) { case "1": document.getElementById("arquivo1").style.display = "block"; break; case "2": document.getElementById("arquivo1").style.display = "block"; document.getElementById("arquivo2").style.display = "block"; break; case "3": document.getElementById("arquivo1").style.display = "block"; document.getElementById("arquivo2").style.display = "block"; document.getElementById("arquivo3").style.display = "block"; break; case "4": document.getElementById("arquivo1").style.display = "block"; document.getElementById("arquivo2").style.display = "block"; document.getElementById("arquivo3").style.display = "block"; document.getElementById("arquivo4").style.display = "block"; break; case "5": document.getElementById("arquivo1").style.display = "block"; document.getElementById("arquivo2").style.display = "block"; document.getElementById("arquivo3").style.display = "block"; document.getElementById("arquivo4").style.display = "block"; document.getElementById("arquivo5").style.display = "block"; break; } } }