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; } function isMail(m) { if (!m) return false; var reg = new RegExp('^([\.a-zA-Z0-9_-]+)@([\.a-zA-Z0-9_-]){1,}[\.]{1,1}[a-zA-Z]{2,3}$'); if(!reg.test(m)) return false; return true; } /* 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; ajax('conteudo','neocast/list.php?section='+section+'&page='+newPage+'&castSearchInput='+search,null); } /* Fim Combo de paginação do neoCast */ /* Pesquisa do neoCast */ function neoCast_Search(){ var section = document.getElementById('section').value; ajax('conteudo','neocast/list.php?castSearchInput='+document.getElementById('castSearchInput').value+'§ion='+section,null); } /* Fim Pesquisa do neoCast */ /* Cadastra-se newsLetter */ function openSubscriberWindow() { var obj = document.getElementById('txtEmail'); 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!'); } else { var url = "/neocast/subscriber.php?subscriberMail=" + obj.value; trocaClasse('internas','rodinternas'); ajax('conteudo',url); //obj.value = "Qual é o seu email?"; } } /* Fim do Cadastra-se newsLetter */ /* Cadastra-se newsLetter */ function openSubscriberWindowInternas() { var obj = document.getElementById('txtEmail'); 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!'); } else { var url = "index.html#[page]/neocast/subscriber.php?view=$view&subscriberMail="+ obj.value; trocaClasse('internas','rodinternas'); location.href=url; } } /* Fim do Cadastra-se newsLetter */ /* Enviar para um amigo - neoCast */ function checkFieldsEnviarAmigo() { form = document.getElementById('frmEnviaAmigo'); if(trim(form.seuNome.value) == '') { alert('Informe o nome'); form.seuNome.focus(); return false; } if(!isMail(trim(form.seuEmail.value))) { alert('Informe o email'); form.seuEmail.focus(); return false; } if(trim(form.amigoNome.value) == '') { alert('Informe o nome'); form.amigoNome.focus(); return false; } if(!isMail(trim(form.amigoEmail.value))) { alert('Informe o email'); form.amigoEmail.focus(); return false; } return true; } /* Fim Enviar para um amigo - neoCast */ /* Validação do formulário fale conosco */ function checkFormFale(){ var form = document.getElementById('frmFaleConosco'); 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.MENSAGEM.value) == ""){ alert('Campo Mensagem vazio!') form.MENSAGEM.focus(); return false; } return true; } /* Fim Validação do formulário de fale conosco */ function trocaClasse(){ if (document.getElementById('conteudo')){ document.getElementById('conteudo').className = 'cont_internas' } } var menusAbertos = new Array(); var naoEncontrou = true; /* Função de controle do Menu */ function abreMenu(nomeId,nomePai) { if (menusAbertos.length == 0) naoEncontrou = true; for (var i = 0; i < menusAbertos.length; i++) { if (menusAbertos[i] == nomeId) { fechaMenu(nomeId); menusAbertos.pop(nomeId); naoEncontrou = false; break; } else naoEncontrou = true; } if(document.getElementById(nomeId)){ if (naoEncontrou == true) { //alert("Abriu: " + nomeId); document.getElementById(nomeId).style.display = 'block'; menusAbertos.push(nomeId); //naoEncontrou = false; } /*lis = document.getElementsByTagName('li'); for (var i = 0; i < lis.length; i++) { nome = 'submnu'+i; if ((nome != nomeId) && (nome != nomePai)) { fechaMenu(nome); } }*/ } //alert("A: " + menusAbertos); } function fechaMenu(nomeId) { //alert("fecha: " + nomeId); //for if(document.getElementById(nomeId)){ document.getElementById(nomeId).style.display = 'none'; } } /* Fim da Função de controle do Menu */