/*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('frFale'); 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.COMENTARIOS.value)==""){ alert('Campo Comentários vazio!'); form.COMENTARIOS.focus(); return false; } form.submit(); } /*Fim Validação do formulário de contato*/ /*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*/ /* Função de controle do Menu */ function controlaMenu(nomeDiv) { menuPrincipal = document.getElementById(nomeDiv); menuPrincipal.className = menuPrincipal.className == 'esconde' ? 'mostra' : 'esconde'; } /* Fim da Função de controle do Menu */ /*Validação do formulário de contato*/ function checkFormReserva(){ var form = document.getElementById('frReserva'); if(trim(form.PARTICIPANTE.value)==""){ alert('Campo PARTICIPANTE vazio!'); form.PARTICIPANTE.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(document.getElementById('OBSERVACOES').value)==""){ alert('Campo OBSERVAÇÕES vazio!'); document.getElementById('OBSERVACOES').focus(); return false; } form.submit(); } /*Fim Validação do formulário de contato*/