/* Funções para controle do iFrame */ var iframe_move_speed = 6; var iframe_move_update = 20; var obj_arg, iframe_obj, iframe_scroll_way, iframe_move_obj; /* Exemplo: onmouseover='iframe_move('nomeIframe','left|rigth|up|douwn')' onmouseout='iframe_move_stop()' */ function iframe_move(arg, way) { obj_arg = arg; iframe_obj = window.frames[obj_arg]; iframe_scroll_way = way; iframe_move_obj = window.setTimeout('iframe_move_action()', iframe_move_update); } function iframe_move_stop() { window.clearTimeout(iframe_move_obj); } function iframe_move_action() { if (iframe_scroll_way == "up") { x = 0; y = - iframe_move_speed; } if (iframe_scroll_way == "down") { x = 0; y = iframe_move_speed; } if (iframe_scroll_way == "left") { x = - iframe_move_speed; y = 0; } if (iframe_scroll_way == "right") { x = iframe_move_speed; y = 0; } iframe_obj.scrollBy(x, y); iframe_move(obj_arg, iframe_scroll_way); } /* Fim das funções do iFrame */ /* Função de redimensionamento de uma pop-up */ function ow (x, y) { var t = window.open ('' , 'window', 'width=' + x + ',height=' + y + ',scrollbars=yes'); t.focus(); } function submititem(reference,iditem,qtde){ if(qtde==''){ document.getElementById('qtd').focus(); alert('Quantidade desejada vazia!'); return false; } window.location.href= "template.php?pagina=refrigas_Kart.php&reference="+reference+"&add_item="+iditem+"&qtd="+qtde; } function teste(reference,iditem,qtde,KeyCode){ if(KeyCode==13){ if(qtde!='') window.location.href= "template.php?pagina=refrigas_Kart.php&reference="+reference+"&add_item="+iditem+"&qtd="+qtde; else alert('Quantidade desejada vazia!') } } /*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 checkFormContato(){ form = document.frmContato; if(trim(form.nome.value) == '') { alert('Informe o nome'); form.nome.focus(); return false; } if(!isMail(trim(form.email.value))) { alert('Informe o email corretamente'); form.email.focus(); return false; } if(trim(form.ddd.value) == '') { alert('Informe o ddd'); form.ddd.focus(); return false; } if(trim(form.telefone.value) == '') { alert('Informe o telefone'); form.telefone.focus(); return false; } if(trim(form.cidade.value) == '') { alert('Informe a cidade'); form.cidade.focus(); return false; } if(trim(form.estado.value) == '') { alert('Informe o estado'); form.estado.focus(); return false; } if(trim(form.mensagem.value) == '') { alert('Informe a mensagem'); form.mensagem.focus(); return false; } //form.action = 'neoMailer/action.php'; return true; } /*Fim Validação do formulário de contato*/ /* Função que apaga dados do formulário de contato */ function apagaDadosFormContato(){ form = document.frmContato; form.nome.value = ''; form.email.value = ''; form.ddd.value = ''; form.telefone.value = ''; form.cidade.value = ''; form.mensagem.value = ''; form.nome.focus(); } /* Fim da função que apaga dados do formulário de contato */ /* 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); window.location.href = 'template.php?pagina=neoCast/list.php§ion='+section+'&page='+newPage+'&castSearchInput='+search; } /* Fim Combo de paginação do neoCast */ /* Enviar para um amigo - neoCast */ function checkFieldsEnviarAmigo() { form = document.getElementById('frEnviaAmigo'); 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 */ /* 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 = "template.php?pagina=neoCast/subscriber.php&classTitulo=titulo_informativo&subscriberMail=" + obj.value; //ajaxSendRequest('conteudo',url,document.frLetter); window.location.href = url; } } /* Fim do Cadastra-se newsLetter */ /* Função de controle do Menu */ function abreMenu(id) { menuPrincipal = document.getElementById(id); menuPrincipal.style.display = 'block'; } function fechaMenu(id) { menuPrincipal = document.getElementById(id); menuPrincipal.style.display = 'none'; }