var ae_cb = null; function ae$(a) { return document.getElementById(a); } function ae_prompt(cb, q, a) { ae_cb = cb; ae$('aep_t').innerHTML = 'Personality Tuning:'; ae$('aep_prompt').innerHTML = q; ae$('aep_text').value = a; ae$('aep_ovrl').style.display = ae$('aep_ww').style.display = ''; ae$('aep_text').focus(); ae$('aep_text').select(); } var qual=0; function ae_clk(m) { ae$('aep_ovrl').style.display = ae$('aep_ww').style.display = 'none'; if(m && parseInt(ae$('aep_text').value,10)) window.location="pedido?altera="+qual+"&quantidade="+parseInt(ae$('aep_text').value,10); } /* (function(){ if(!document.uniqueID){return;}; var nativeSetInterval = window.setInterval; window.setInterval = function(fn,ms) { var param = []; if(arguments.length<=2) { return nativeSetInterval(fn,ms); } else { for(var i=2;i=1024 && oi.style.visibility=="hidden"){ oi.style.position="inherit"; oi.style.visibility="visible"; document.getElementById("corpo").style.marginRight='200px'; } } /* if(screen.width<1024 && oi.style.visibility=="visible") oi.style.visibility="hidden"; else if(screen.width>=1024 && oi.style.visiblity=="hidden") oi.style.visibility="visible"; */ } //setInterval(eval("maisvendidos()"),2000); setInterval( function(){ if(oi=document.getElementById("maisvendidos")){ var oi=document.getElementById("maisvendidos"); if(oi.style.visibility==""){ oi.style.visibility="visible"; // oi.style.position="inherit"; } if(document.body.clientWidth<1024 && oi.style.visibility=="visible"){ // alert("diminui"); oi.style.position="absolute"; oi.style.top="-100000px"; oi.style.left="0px"; oi.style.visibility="hidden"; document.getElementById("corpo").style.marginRight='0px'; } else if(document.body.clientWidth>=1024 && oi.style.visibility=="hidden"){ // alert("aumenta"); // oi.style.position="inherit"; oi.style.position=""; oi.style.left="0px"; oi.style.visibility="visible"; document.getElementById("corpo").style.marginRight='200px'; } } },100); function vaisub(){ alert('oi'); window.location="produtos?cat="+document.getElementById("subcat").value; } function envia(){ if(document.forms[1]) document.forms[1].submit(); else document.forms[0].submit(); } function altera(idproduto,qte){ qual=idproduto; ae_prompt("oi","Qual a quantidade deste produto que deseja comprar?",qte); } try{ xmlhttp = new XMLHttpRequest(); }catch(ajax1a){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }catch(ajax1b){ try{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }catch(ajax1c){ xmlhttp = false; } } } var ultimo="zzzzz"; var to=null; var idcidade=null; function buscacep(){ var cep=document.getElementById("cep"); if(ultimo!=cep.value){ if(to) clearTimeout(to); to=setTimeout("atualizacep()",100); ultimo=cep.value; } } function atualizacep(){ var cep=document.getElementById("cep").value; if(cep.length==8){ if(xmlhttp.readyState==0 || xmlhttp.readyState==4){ xmlhttp.open("POST","ajax_cep",true); var valores="cep="+cep; xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.setRequestHeader("Content-length",valores.length); xmlhttp.setRequestHeader("Connection", "close"); xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState==4){ texto=xmlhttp.responseText; if(texto=="erro") alert("CEP inválido!"); else{ var textos=texto.split("|||"); var cidade=document.getElementById("cidade"); var estado=document.getElementById("estado"); var endereco=document.getElementById("endereco"); var bairro=document.getElementById("bairro"); endereco.value=textos[2]; bairro.value=textos[3]; for(i=0;i1){ var tts=textos[i].split("___"); insereselect("cidade",tts[1],tts[0]); } } } }; xmlhttp.send(valores); } } } function limpaselect(nome){ var campo=document.getElementById(nome); if(campo.options.length>0){ while(campo.options.length>0) campo.remove(campo.options.length-1); } } function insereselect(nome,texto,valor){ var campo=document.getElementById(nome); var opcao=document.createElement('option'); opcao.text=texto; opcao.value=valor; if(idcidade==valor) opcao.setAttribute("selected",true); try{ campo.add(opcao,null); } catch(ex){ campo.add(opcao); } } function aplicamascara(tipo,elemento){ var i=0; var temp=""; if(tipo=="CEP"){ for(i=0;i5) temp=temp.substr(0,5)+"-"+temp.substr(5,3); elemento.value=temp; } } function escolhepessoa(tipo){ if(tipo=="F"){ document.forms[0].cpf.disabled=false; document.forms[0].rg.disabled=false; document.forms[0].cnpj.disabled=true; document.forms[0].ie.disabled=true; document.forms[0].razao.disabled=true; document.forms[0].fantasia.disabled=true; }else{ document.forms[0].cpf.disabled=true; document.forms[0].rg.disabled=true; document.forms[0].cnpj.disabled=false; document.forms[0].ie.disabled=false; document.forms[0].razao.disabled=false; document.forms[0].fantasia.disabled=false; } }