/* pega o tipo de browser e aumenta o menu principal */ function NomeBrowser() { var b = navigator.appName; var v = this.version = navigator.appVersion; var ua = navigator.userAgent.toLowerCase(); this.v = parseInt(v); this.safari = ua.indexOf("safari") > -1; this.opera = ua.indexOf("opera") > -1; this.ns = !this.opera && !this.safari && (b=="Netscape"); this.ie = !this.opera && (b=="Microsoft Internet Explorer"); this.gecko = ua.indexOf('gecko') > -1; if (this.ns) { this.ns4 = (this.v==4); this.ns6 = (this.v>=5); this.b = "Netscape"; document.getElementById('MenuPrincipal').style.width = 250; } else if (this.ie) { this.ie4 = this.ie5 = this.ie55 = this.ie6 = false; if (v.indexOf('MSIE 4') > 0) {this.ie4 = true; this.v = 4;} else if (v.indexOf('MSIE 5') > 0) {this.ie5 = true; this.v = 5;} else if (v.indexOf('MSIE 5.5') > 0) {this.ie55 = true; this.v = 5.5;} else if (v.indexOf('MSIE 6') > 0) {this.ie6 = true; this.v = 6;} this.b = "MSIE"; } else if (this.opera) { this.v=parseInt(ua.substr(ua.indexOf("opera")+6,1)); this.opera6=(this.v >= 6); this.opera7=(this.v >= 7); this.b = "Opera"; document.getElementById('MenuPrincipal').style.width = 250; } else if (this.safari) { this.ns6 = (this.v >= 5); this.b = "Safari"; document.getElementById('MenuPrincipal').style.width = 250; } this.dom = (document.createElement && document.appendChild && document.getElementsByTagName)? true : false; this.def = (this.ie||this.dom); this.win32 = ua.indexOf("win") > -1; this.mac = ua.indexOf("mac") > -1; this.other = (!this.win32 && !this.mac); this.supported = (this.def||this.ns4||this.ns6||this.opera)? true:false; } /* para o campo de DEFAULT.ASPX usando ENTER no lugar do botao */ function EnterURL(evento) { var tecla = (evento.which) ? evento.which : event.keyCode if (tecla == 13) { window.location.href = "Busca.aspx"; return false; } else { return true; } } function EnterURLLogin(evento, nome) { var tecla = (evento.which) ? evento.which : event.keyCode if (tecla == 13) { //window.location.href = "Busca.aspx"; document.getElementById(nome).click(); return false; } else { return true; } } /* retorna a url relacionada a materia clicada no jornal */ function AbrirMateria(url) { eval("opener.parent.location=url"); } /* abre janela popup do jornal centralizada */ function AbrePopupJornal(cd_edicao, form) { if(cd_edicao == null) { alert('Erro ao carregar jornal. Entre em contato com a Valor Economico.'); } else { var esquerda = 0;//(screen.width - 750 )/2; var topo = 0;//(screen.height - 600)/2; form.action = "http://valor.ideavalley.com.br/token.php"; //'Capa.aspx?cd_edicao=' + cd_edicao; form.method = "post"; form.target = "Capa"; form.onsubmit = window.open(form.action,'Capa','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,menubar=no,width=1020,outerWidth=1024,height=768, top=' + topo + ', left=' + esquerda); form.submit(); } } function AbrePopupJornalBanco(cd_edicao) { if(cd_edicao == null) { alert('Erro ao carregar jornal. Entre em contato com a Valor Economico.'); } else { var esquerda = (screen.width - 750 )/2; var topo = (screen.height - 600)/2; window.open('Capa.aspx?cd_edicao=' + cd_edicao,'Popup','location=0,status=0,scrollbars=1,height=600, width=750, top=' + topo + ', left=' + esquerda); } } //------------------------------------------------------------------------------- // Tamanho da fonte function mudaFonte( tipo , id_do_div ) { var tam = document.getElementById(id_do_div).style.fontSize; tam = parseInt(tam.replace(/px/,"")); if( tipo == 'mais' ) { if(tam < 16) tam += 2; } else { if(tam > 8) tam -= 2; } if(isNaN(tam)) document.getElementById(id_do_div).style.fontSize='12px'; else document.getElementById(id_do_div).style.fontSize=tam+'px'; } function setarTamFonteNoticia(tam) { document.getElementById('div_conteudo_materia').style.fontSize=tam; } //------------------------------------------------------------------------------- function retornarEventoPadronizado(){ var eventPadronizado; if (document.all) { eventPadronizado = event.keyCode; } // Internet Explorer else if(document.layers && navigator.appName.indexOf("Mozilla") == -1) { eventPadronizado = event.which; } //Netscape else { eventPadronizado = event.which; }// Mozilla / FireFox / Opera return eventPadronizado; } function retornarEventoPadronizado2(e){ var keynum; var keychar; var numcheck; if(window.event) // IE { keynum = e.keyCode; } else if(e.which) // Netscape/Firefox/Opera { keynum = e.which; } return keynum; } //------------------------------------------------------------------------------- function numbers(e) { var keynum; var keychar; var numcheck; var resposta; if(window.event) // IE { keynum = e.keyCode; } else if(e.which) // Netscape/Firefox/Opera { keynum = e.which; if (keynum == 8) { resposta = true; } } keychar = String.fromCharCode(keynum); numcheck = /[0-9]/; if(resposta != true){ resposta = numcheck.test(keychar); } return resposta; } function login(e) { var keynum; var keychar; var numcheck; var resposta; if(window.event) // IE { keynum = e.keyCode; } else if(e.which) // Netscape/Firefox/Opera { keynum = e.which; if (keynum == 8) { resposta = true; } } keychar = String.fromCharCode(keynum); numcheck = /[A-Za-z.@]/; if(resposta != true){ resposta = numcheck.test(keychar); } return resposta; } function numbersOnPast(e) { var keynum; var keychar; var numcheck; var resposta; if(window.event) // IE { keynum = e.keyCode; } else if(e.which) // Netscape/Firefox/Opera { keynum = e.which; if (keynum == 8) { resposta = true; } } keychar = String.fromCharCode(keynum); numcheck = /^[0-9]+$/ ; if(resposta != true){ resposta = numcheck.test(window.clipboardData.getData('Text')); } return resposta; } function ValidarCampoBusca(busca) { var strbusca = document.getElementById(busca).value; if (strbusca == "" || strbusca.length < 3) { alert('O campo de busca deve conter pelo menos 3 letras!'); return false; } } function ValidarCamposNews(strnome, stremail, strcpf){ var nome = document.getElementById(strnome).value; var email = document.getElementById(stremail).value; var cpf = document.getElementById(strcpf).value; var valido = true; if(nome == "" || nome.length > 255) { alert('Nome inva\u0301lido ou vazio!'); valido = false; } else { var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; if(email == "" || email.length > 255 || filter.test(email) == false) { alert('E-mail inva\u0301lido ou vazio!'); valido = false; } else { if(cpf == "" || cpf.length != 14) { alert('CPF inva\u0301lido ou vazio!'); valido = false; } else{} } } return valido; } function autotab(original,destination){ if (original.getAttribute&&original.value.length==original.getAttribute("maxlength")) destination.focus() } function ConfirmarExclusao() { if(confirm('Deseja excluir este registro?') == false) { return false; } } //Código para Revista Flash function acesso(lngAcesso, url) { var a; if (lngAcesso == 1) { a=window.open(url,'oesp','titlebar=yes,status=no,resizable=no,scrollbars=no,top=0,left=0,width='+(screen.availWidth - 100) +',height='+(screen.availHeight - 100)); a.focus(); } else { a=window.open(url,'oesp','titlebar=yes,status=no,resizable=no,scrollbars=no,top=0,left=0,width='+(screen.availWidth - 100) +',height='+(screen.availHeight - 100)); a.focus(); //window.open('resolucao.asp') } } function JanelaFull(url){ w = screen.width; if(w >= 1024) acesso(1,url); if(w <= 800) acesso(2,url); } function janelaDigital(){ a=window.open("http://www.digitalpages.com.br","_blank",""); a.focus(); } function Refresh() { var hidScroll = document.getElementById('hidScroll'); window.location='Default.aspx?p=' + hidScroll.value; } function RefreshPaginasInternas(caminho) { var tam = null; if (document.getElementById('div_conteudo_materia') != null) tam = document.getElementById('div_conteudo_materia').style.fontSize; var hidScroll = document.getElementById('ctl00_hidScroll'); var result = null; if (tam != null) result = caminho + "&p=" + hidScroll.value + "&t=" + tam; else result = caminho + "&p=" + hidScroll.value; window.location = result; } function fScrollMove() { var hidScroll = document.getElementById('hidScroll'); hidScroll.value = document.documentElement.scrollTop; //val.scrollTop; } function fScrollMovePaginasInternas() { var hidScroll = document.getElementById('ctl00_hidScroll'); hidScroll.value = document.documentElement.scrollTop; //val.scrollTop; } function fScrollAposRefresh(valor) { //window.scrollTo(0, hidScrollDefinitivo.value); document.documentElement.scrollTop = valor; } function fScrollAposRefreshPaginasInternas(valor) { //window.scrollTo(0, hidScrollDefinitivo.value); document.documentElement.scrollTop = valor; } function mascara(e,src,mask) { if(window.event) { _TXT = e.keyCode; } else if(e.which) { _TXT = e.which; } if(_TXT > 47 && _TXT < 58) { var i = src.value.length; var saida = mask.substring(0,1); var texto = mask.substring(i); if(texto.substring(0,1) != saida) { src.value += texto.substring(0,1); } return true; } else { if (_TXT != 8) { return false; } else { return true; } } } //------------------------------------------------------------------------------- // Pagina de impressao var printWindow = null; function jscPrint(id) { var obj = document.getElementById(id); var htmlContent = obj.innerHTML printWindow = window.open("","","left=50000,top=50000,height=0,width=0,sroll=yes"); printWindow.document.open(); printWindow.document.write(""); printWindow.document.write("
"); printWindow.document.write(''); printWindow.document.write(""); printWindow.document.write(""); printWindow.document.write('
');
printWindow.document.write("
');
printWindow.document.write("