/*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*/ /*Pesquisa do neoCast*/ function neoCast_SearchByKeyCode(KeyCode){ var section = document.getElementById('section').value; if (KeyCode == 13 && section > 0) { //event.keyCode = null; ajaxSendRequest('esColuna1','neocast/list.php?castSearchInput='+document.getElementById('castSearchInput').value+'§ion='+section,null); } } /*Fim Pesquisa do neoCast*/ /*Combo de paginação do neoCast*/ function neoCast_ChPage(comboSelect){ var section = document.getElementById('section').value; var search = document.getElementById('castSearchInput').value; var newPage = comboSelect[comboSelect.selectedIndex].value; ajaxSendRequest('esColuna1','neocast/list.php?section='+section+'&page='+newPage+'&castSearchInput='+search,null); } /*Fim Combo de paginação do neoCast*/ /*Validação do formulário de contato*/ function checkFormFaleConosco(){ var form = document.getElementById('novo_registro'); 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.ASSUNTO.value) == ""){ alert('Campo assunto vazio!'); form.ASSUNTO.focus(); return false; } if(trim(form.MENSAGEM.value)==""){ alert('Campo Mensagem vazio!'); form.MENSAGEM.focus(); return false; } form.submit(); } /*Fim Validação do formulário de contato*/ /*Validação do login da Área Restrita*/ function checkFormAreaRestrita(){ var form = document.getElementById('login'); if(trim(form.USUARIO.value)==""){ alert('Campo USUARIO vazio!'); form.USUARIO.focus(); return false; } else{ if(!isMail(form.USUARIO.value)){ alert('Usuário Incorreto!'); form.USUARIO.focus(); return false; } if(trim(form.SENHA.value)==""){ alert('Campo Senha vazio!'); form.SENHA.focus(); return false; } } } /*Fim da Validação do do login da Área Restrita*/ /*Validação do Novo Registro - Área Restrita*/ function checkFormRegistro(){ var form = document.getElementById('novo_registro'); if(trim(form.NOME_ANIMAL.value)==""){ alert('Campo Nome do Animal vazio!'); form.NOME_ANIMAL.focus(); return false; } if(trim(form.QTD_EXAMES.value) == "") { alert('Selecione a quantidade de exames!'); form.QTD_EXAMES.focus(); return false; } } /*Fim da Validação do Novo Registro - Área Restrita*/ /*Verifica quantidade de tipos de exames*/ function verifica_qtd_exames() { var form = document.getElementById('novo_registro'); if(trim(form.QTD_EXAMES.value) == "1") { document.getElementById("TIPO1").style.display = "block"; document.getElementById("TIPO2").style.display = "none"; document.getElementById("TIPO3").style.display = "none"; document.getElementById("TIPO4").style.display = "none"; document.getElementById("TIPO5").style.display = "none"; document.getElementById("TIPO2").value = ""; document.getElementById("TIPO3").value = ""; document.getElementById("TIPO4").value = ""; document.getElementById("TIPO5").value = ""; } if(trim(form.QTD_EXAMES.value) == "2") { document.getElementById("TIPO1").style.display = "block"; document.getElementById("TIPO2").style.display = "block"; document.getElementById("TIPO3").style.display = "none"; document.getElementById("TIPO4").style.display = "none"; document.getElementById("TIPO5").style.display = "none"; document.getElementById("TIPO3").value = ""; document.getElementById("TIPO4").value = ""; document.getElementById("TIPO5").value = ""; } if(trim(form.QTD_EXAMES.value) == "3") { document.getElementById("TIPO1").style.display = "block"; document.getElementById("TIPO2").style.display = "block"; document.getElementById("TIPO3").style.display = "block"; document.getElementById("TIPO4").style.display = "none"; document.getElementById("TIPO5").style.display = "none"; document.getElementById("TIPO4").value = ""; document.getElementById("TIPO5").value = ""; } if(trim(form.QTD_EXAMES.value) == "4") { document.getElementById("TIPO1").style.display = "block"; document.getElementById("TIPO2").style.display = "block"; document.getElementById("TIPO3").style.display = "block"; document.getElementById("TIPO4").style.display = "block"; document.getElementById("TIPO5").style.display = "none"; document.getElementById("TIPO5").value = ""; } if(trim(form.QTD_EXAMES.value) == "5") { document.getElementById("TIPO1").style.display = "block"; document.getElementById("TIPO2").style.display = "block"; document.getElementById("TIPO3").style.display = "block"; document.getElementById("TIPO4").style.display = "block"; document.getElementById("TIPO5").style.display = "block"; } } /*Fim Verifica quantidade de tipos de exames*/ /*Cadastra-se newsLetter*/ function openSubscriberWindow() { var obj = document.getElementById('newsletter'); var regex = new RegExp('^([\.a-zA-Z0-9_-]+)@([\.a-zA-Z0-9_-]){1,}[\.]{1,1}[a-zA-Z]{2,3}$'); if(!regex.test(obj.value)) { alert('Endereço de email inválido!'); return false; } window.open('/neocast/subscriber.php?view=$view&subscriberMail='+obj.value, '', 'width=500, height=400, scrollbars=yes, resizable:no, scroll:no, location:no'); obj.value = ''; } /*Fim Cadastra-se newsLetter*/ /*Abre popUp*/ function popUp (x, y) { var t = window.open ('' , 'window', 'width=' + x + ',height=' + y + ',scrollbars=yes'); t.focus(); } /*Fim Abre popUp*/ /*Limpa Formulário*/ function checkFormClear(){ var form = document.getElementById('esForm'); form.document.reset(); } /*Fim Limpa Formulário*/ /* Função que lista os arquivos para uma determinada categoria escolhida */ function neoDownload_ChPage(){ url = "neodownload/listaArquivos.php?category=" + document.getElementById('category').value; ajax('neoDownload_listaArquivos', url, null); } /* Fim da Função que lista os arquivos para uma determinada categoria escolhida */ /* Função que grava log de vizualização do neoBanner */ function logView(imgId,area,logPage){ document.getElementById('neoBannerHiddenFrame_'+area).src = logPage + '?logView=TRUE&bannerId='+imgId+'&area='+area; } /* Fim da Função que grava log de vizualização do neoBanner */