// JavaScript Document function mostrarCategoria(id) { if(document.getElementById('cat'+id).style.display == "none") { document.getElementById('cat'+id).style.display = "block"; } else { document.getElementById('cat'+id).style.display = "none"; } } function mostrarCategoriaSup(id) { if(document.getElementById('catsup'+id).style.display == "none") { document.getElementById('catsup'+id).style.display = "block"; } else { document.getElementById('catsup'+id).style.display = "none"; } } function mostrarResposta(id) { if(document.getElementById('resposta'+id).style.display == "none") { document.getElementById('resposta'+id).style.display = "block"; } else { document.getElementById('resposta'+id).style.display = "none"; } } function ampliarImagem(id, alvo, pasta) { if(document.getElementById(alvo)) { var objFotoGrande = document.getElementById(alvo); var imagem = pasta + "/" + id + "g.jpg"; objFotoGrande.src = imagem; } else { alert("Imagem não encontrada!"); } } function popupImagem(id) { window.open("popup.php?" + id, "", "resizable=no,toolbar=no,status=no,menubar=no,maximize=no,scrollbars=no,width=50,height=50"); } function popupImagemCaracteristica(id) { window.open("produtos-caracteristicas.php?" + id, "", "resizable=yes,toolbar=no,status=no,menubar=no,maximize=yes,scrollbars=yes,width=100,height=100"); } function popupVideo(id) { window.open(id, "", "resizable=no,toolbar=no,status=no,menubar=no,maximize=no,scrollbars=no,width=380,height=290"); } function validarFornecedores() { var campos_input = new Array("razao", "cidade", "telefone", "fax", "email_vendas", "cnpj", "inscr_estadual", "ramo_atividade", "produtos"); var campos_select = new Array("estado"); var mensagem = "É obrigatório o preenchimento de alguns campos!"; if(!isEmail(document.getElementById("email_vendas").value)) { alert("O campo email não está preenchido corretamente!"); document.getElementById("email_vendas").focus(); return false; } for(i=0; i= 48 && nTecla <= 57) || nTecla == null) { sCode = '('; while (i < sLength) { sCode += sValue.charAt(i); i++; switch (i) { case 2: sCode += ') '; break; case 5: if (sLength <= 8) { sCode += '-'; } break; case 6: if (sLength >= 9) { sCode += '-'; } break; } } element.value = sCode; } else { if (nTecla == 8) return true; else return false; } } function getEvent(evt) { if (evt == null) { return null; // executa ao sair do campo, onBlur } else if (evt.which) { return evt.which; // FF } else { return evt.keyCode; // Opera e IE } } function cleanString(value, pattern) { var total = value.length; var i; for (i = 0; i <= total; i++) { value = value.toString().replace(pattern, ""); } return value; }