Created
October 24, 2018 10:40
-
-
Save leanfj/6098154d9120af5d9b81184c55e66b48 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function chama_ancora(ancora) | |
{ | |
//this.location = "#" + ancora; | |
} | |
function ajaxGet(url,elemento_retorno,exibe_carregando){ | |
/****** | |
* ajaxGet - Coloca o retorno de uma url em um elemento qualquer | |
* Use a vontade mas coloque meu nome nos créditos. Dúvidas, me mande um email. | |
* Versão: 1.2 - 20/04/2006 | |
* Autor: Micox - Náiron José C. Guimarães - micoxjcg@yahoo.com.br | |
* Parametros: | |
* url: string; elemento_retorno: object||string; exibe_carregando:boolean | |
* - Se elemento_retorno for um elemento html (inclusive inputs e selects), | |
* exibe o retorno no innerHTML / value / options do elemento | |
* - Se elemento_retorno for o nome de uma variavel | |
* (o nome da variável deve ser declarado por string, pois será feito um eval) | |
* a função irá atribuir o retorno à variável ao receber a url. | |
*******/ | |
var ajax1 = pegaAjax(); | |
if(ajax1){ | |
url = antiCacheRand(url) | |
ajax1.onreadystatechange = ajaxOnReady | |
ajax1.open("GET", url ,true);//ajax1.setRequestHeader("Content-Type", "text/html; charset=iso-8859-1");//"application/x-www-form-urlencoded"); | |
ajax1.setRequestHeader("Cache-Control", "no-cache"); | |
ajax1.setRequestHeader("Pragma", "no-cache"); | |
if(exibe_carregando){ put("<img src=\"/imagens/ajax_loader.gif\" border=\"0\" alt=\"\" /> Carregando ...") } | |
ajax1.send(null) | |
return true; | |
}else{ | |
return false; | |
} | |
function ajaxOnReady(){ | |
if (ajax1.readyState==4){ | |
if(ajax1.status == 200){ | |
var texto=ajax1.responseText; | |
if(texto.indexOf(" ")<0) texto=texto.replace(/\+/g," ");//texto=unescape(texto); //descomente esta linha se tiver usado o urlencode no php ou asp | |
put(texto); | |
extraiScript(texto); | |
}else{ | |
if(exibe_carregando){put("Falha no carregamento. " + httpStatus(ajax1.status));} | |
} | |
ajax1 = null | |
}else if(exibe_carregando){//para mudar o status de cada carregando | |
put("<img src=\"/imagens/ajax_loader.gif\" border=\"0\" alt=\"\" /> Carregando ..." ) | |
} | |
} | |
function put(valor){ //coloca o valor na variavel/elemento de retorno | |
if((typeof(elemento_retorno)).toLowerCase()=="string"){ //se for o nome da string | |
if(valor!="Falha no carregamento"){ | |
eval(elemento_retorno + '= unescape("' + escape(valor) + '")') | |
} | |
}else if(elemento_retorno.tagName.toLowerCase()=="input"){ | |
valor = escape(valor).replace(/\%0D\%0A/g,"") | |
elemento_retorno.value = unescape(valor); | |
}else if(elemento_retorno.tagName.toLowerCase()=="select"){ | |
select_innerHTML(elemento_retorno,valor) | |
}else if(elemento_retorno.tagName){ | |
elemento_retorno.innerHTML = valor;//alert(elemento_retorno.innerHTML) | |
} | |
} | |
function pegaAjax(){ //instancia um novo xmlhttprequest baseado na getXMLHttpObj que possui muitas cópias na net e eu nao sei quem é o autor original | |
if(typeof(XMLHttpRequest)!='undefined'){return new XMLHttpRequest();} | |
var axO=['Microsoft.XMLHTTP','Msxml2.XMLHTTP','Msxml2.XMLHTTP.6.0','Msxml2.XMLHTTP.4.0','Msxml2.XMLHTTP.3.0']; | |
for(var i=0;i<axO.length;i++){ try{ return new ActiveXObject(axO[i]);}catch(e){} } | |
return null; | |
} | |
function httpStatus(stat){ //retorna o texto do erro http | |
switch(stat){ | |
case 0: return "Erro desconhecido de javascript"; | |
case 400: return "400: Solicitação incompreensível"; break; | |
case 403: case 404: return "404: Não foi encontrada a URL solicitada"; break; | |
case 405: return "405: O servidor não suporta o método solicitado"; break; | |
case 500: return "500: Erro desconhecido de natureza do servidor"; break; | |
case 503: return "503: Capacidade máxima do servidor alcançada"; break; | |
default: return "Erro " + stat + ". Mais informações em http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"; break; | |
} | |
} | |
function antiCacheRand(aurl){ | |
var dt = new Date(); | |
if(aurl.indexOf("?")>=0){// já tem parametros | |
return aurl + "&" + encodeURI(Math.random() + "_" + dt.getTime()); | |
}else{ return aurl + "?" + encodeURI(Math.random() + "_" + dt.getTime());} | |
} | |
} | |
function select_innerHTML(objeto,innerHTML){ | |
/****** | |
* select_innerHTML - altera o innerHTML de um select independente se é FF ou IE | |
* Corrige o problema de não ser possível usar o innerHTML no IE corretamente | |
* Veja o problema em: http://support.microsoft.com/default.aspx?scid=kb;en-us;276228 | |
* Use a vontade mas coloque meu nome nos créditos. Dúvidas, me mande um email. | |
* Versão: 1.0 - 06/04/2006 | |
* Autor: Micox - Náiron José C. Guimarães - micoxjcg@yahoo.com.br | |
* Parametros: | |
* objeto(tipo object): o select a ser alterado | |
* innerHTML(tipo string): o novo valor do innerHTML | |
*******/ | |
objeto.innerHTML = "" | |
var selTemp = document.createElement("micoxselect") | |
var opt; | |
selTemp.id="micoxselect1" | |
document.body.appendChild(selTemp) | |
selTemp = document.getElementById("micoxselect1") | |
selTemp.style.display="none" | |
if(innerHTML.toLowerCase().indexOf("<option")<0){//se não é option eu converto | |
innerHTML = "<option>" + innerHTML + "</option>" | |
} | |
innerHTML = innerHTML.replace(/<option/g,"<span").replace(/<\/option/g,"</span") | |
selTemp.innerHTML = innerHTML | |
for(var i=0;i<selTemp.childNodes.length;i++){ | |
if(selTemp.childNodes[i].tagName){ | |
opt = document.createElement("OPTION") | |
for(var j=0;j<selTemp.childNodes[i].attributes.length;j++){ | |
opt.setAttributeNode(selTemp.childNodes[i].attributes[j].cloneNode(true)) | |
} | |
opt.value = selTemp.childNodes[i].getAttribute("value") | |
opt.text = selTemp.childNodes[i].innerHTML | |
if(document.all){ //IEca | |
objeto.add(opt) | |
}else{ | |
objeto.appendChild(opt) | |
} | |
} | |
} | |
document.body.removeChild(selTemp) | |
selTemp = null | |
} | |
function extraiScript(texto){ | |
//Maravilhosa função feita pelo SkyWalker.TO do imasters/forum | |
//http://forum.imasters.com.br/index.php?showtopic=165277& | |
// inicializa o inicio >< | |
var ini = 0; | |
// loop enquanto achar um script | |
while (ini!=-1){ | |
// procura uma tag de script | |
ini = texto.indexOf('<script', ini); | |
// se encontrar | |
if (ini >=0){ | |
// define o inicio para depois do fechamento dessa tag | |
ini = texto.indexOf('>', ini) + 1; | |
// procura o final do script | |
var fim = texto.indexOf('</script>', ini); | |
// extrai apenas o script | |
codigo = texto.substring(ini,fim); | |
// executa o script | |
//eval(codigo); | |
/********************** | |
* Alterado por Micox - micoxjcg@yahoo.com.br | |
* Alterei pois com o eval não executava funções. | |
***********************/ | |
novo = document.createElement("script") | |
novo.text = codigo; | |
document.body.appendChild(novo); | |
} | |
} | |
} | |
// FUNÇÕES | |
// === Máscaras de campos === | |
function mascara(o,f){ | |
v_obj=o | |
v_fun=f | |
setTimeout("execmascara()",1) | |
} | |
function execmascara(){ | |
v_obj.value=v_fun(v_obj.value) | |
} | |
function mvalor(v){ | |
v=v.replace(/\D/g,"");//Remove tudo o que não é dígito | |
v=v.replace(/(\d)(\d{8})$/,"$1.$2");//coloca o ponto dos milhões | |
v=v.replace(/(\d)(\d{5})$/,"$1.$2");//coloca o ponto dos milhares | |
v=v.replace(/(\d)(\d{2})$/,"$1,$2");//coloca a virgula antes dos 2 últimos dígitos | |
return v; | |
} | |
function leech(v){ | |
v=v.replace(/o/gi,"0") | |
v=v.replace(/i/gi,"1") | |
v=v.replace(/z/gi,"2") | |
v=v.replace(/e/gi,"3") | |
v=v.replace(/a/gi,"4") | |
v=v.replace(/s/gi,"5") | |
v=v.replace(/t/gi,"7") | |
return v | |
} | |
function soNumeros(v){ | |
return v.replace(/\D/g,"") | |
} | |
function telefone(v){ | |
if(v.length >= 4) | |
{ | |
if(v.indexOf('(11)') >= 0) | |
{ | |
v=v.replace(/\D/g,"") //Remove tudo o que não é dígito | |
v=v.replace(/^(\d\d)(\d)/g,"($1) $2") //Coloca parênteses em volta dos dois primeiros dígitos | |
v=v.replace(/(\d{5})(\d)/,"$1-$2") //Coloca hífen entre o quarto e o quinto dígitos | |
} | |
else | |
{ | |
v=v.replace(/\D/g,"") //Remove tudo o que não é dígito | |
v=v.replace(/^(\d\d)(\d)/g,"($1) $2") //Coloca parênteses em volta dos dois primeiros dígitos | |
v=v.replace(/(\d{4})(\d)/,"$1-$2") //Coloca hífen entre o quarto e o quinto dígitos | |
} | |
} | |
return v | |
} | |
function cpf(v){ | |
v=v.replace(/\D/g,"") //Remove tudo o que não é dígito | |
v=v.replace(/(\d{3})(\d)/,"$1.$2") //Coloca um ponto entre o terceiro e o quarto dígitos | |
v=v.replace(/(\d{3})(\d)/,"$1.$2") //Coloca um ponto entre o terceiro e o quarto dígitos | |
//de novo (para o segundo bloco de números) | |
v=v.replace(/(\d{3})(\d{1,2})$/,"$1-$2") //Coloca um hífen entre o terceiro e o quarto dígitos | |
return v | |
} | |
function cep(v){ | |
v=v.replace(/\D/g,"") //Remove tudo o que não é dígito | |
v=v.replace(/^(\d{5})(\d)/,"$1-$2") //Esse é tão fácil que não merece explicações | |
return v | |
} | |
function data(v){ | |
v=v.replace(/\D/g,"") //Remove tudo o que não é dígito | |
v=v.replace(/^(\d{2})(\d{2})(\d)/,"$1/$2/$3") //Esse é tão fácil que não merece explicações | |
return v | |
} | |
function cnpj(v){ | |
v=v.replace(/\D/g,"") //Remove tudo o que não é dígito | |
v=v.replace(/^(\d{2})(\d)/,"$1.$2") //Coloca ponto entre o segundo e o terceiro dígitos | |
v=v.replace(/^(\d{2})\.(\d{3})(\d)/,"$1.$2.$3") //Coloca ponto entre o quinto e o sexto dígitos | |
v=v.replace(/\.(\d{3})(\d)/,".$1/$2") //Coloca uma barra entre o oitavo e o nono dígitos | |
v=v.replace(/(\d{4})(\d)/,"$1-$2") //Coloca um hífen depois do bloco de quatro dígitos | |
return v | |
} | |
function romanos(v){ | |
v=v.toUpperCase() //Maiúsculas | |
v=v.replace(/[^IVXLCDM]/g,"") //Remove tudo o que não for I, V, X, L, C, D ou M | |
//Essa é complicada! Copiei daqui: http://www.diveintopython.org/refactoring/refactoring.html | |
while(v.replace(/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/,"")!="") | |
v=v.replace(/.$/,"") | |
return v | |
} | |
function site(v){ | |
//Esse sem comentarios para que você entenda sozinho ;-) | |
v=v.replace(/^http:\/\/?/,"") | |
dominio=v | |
caminho="" | |
if(v.indexOf("/")>-1) | |
dominio=v.split("/")[0] | |
caminho=v.replace(/[^\/]*/,"") | |
dominio=dominio.replace(/[^\w\.\+-:@]/g,"") | |
caminho=caminho.replace(/[^\w\d\+-@:\?&=%\(\)\.]/g,"") | |
caminho=caminho.replace(/([\?&])=/,"$1") | |
if(caminho!="")dominio=dominio.replace(/\.+$/,"") | |
v="http://"+dominio+caminho | |
return v | |
} | |
// === Fim Máscaras de campos === | |
function question(frase,endereco) | |
{ | |
if(confirm(frase)) | |
{ | |
window.location=endereco; | |
} | |
} | |
function contato(div) | |
{ | |
if(document.getElementById("assunto").value == "") | |
{ | |
//alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("assunto").focus(); | |
return false; | |
} | |
if(document.getElementById("nome").value == "") | |
{ | |
//alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("nome").focus(); | |
return false; | |
} | |
if(document.getElementById("email").value == "") | |
{ | |
//alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("email").focus(); | |
return false; | |
} | |
/* | |
if(document.getElementById("telefone").value == "") | |
{ | |
//alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("telefone").focus(); | |
return false; | |
} | |
*/ | |
if(document.getElementById("mensagem").value == "") | |
{ | |
//alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("mensagem").focus(); | |
return false; | |
} | |
if(document.getElementById("chegou").value == "") | |
{ | |
//alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("chegou").focus(); | |
return false; | |
} | |
if(document.getElementById("news").checked == true) | |
{ | |
var news = 1; | |
} | |
else | |
{ | |
var news = 0; | |
} | |
$(document).ready(function(){ | |
$("#divForm").delay(100).fadeIn(); | |
}); | |
var assunto = document.getElementById("assunto").value; | |
var nome = document.getElementById("nome").value; | |
var email = document.getElementById("email").value; | |
var telefone = document.getElementById("telefone").value; | |
var mensagem = document.getElementById("mensagem").value; | |
var chegou = document.getElementById("chegou").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/contato.php?action=envia&assunto="+assunto+"&nome="+nome+"&email="+email+"&telefone="+telefone+"&mensagem="+mensagem+"&news="+news+"&chegou="+chegou; | |
ajaxGet(url,alvo,true); | |
} | |
function orcamento(div) | |
{ | |
if(document.getElementById("assunto").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("assunto").focus(); | |
return false; | |
} | |
if(document.getElementById("nome").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("nome").focus(); | |
return false; | |
} | |
if(document.getElementById("email").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("email").focus(); | |
return false; | |
} | |
if(document.getElementById("telefone").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("telefone").focus(); | |
return false; | |
} | |
if(document.getElementById("mensagem").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("mensagem").focus(); | |
return false; | |
} | |
if(document.getElementById("news").checked == true) | |
{ | |
var news = 1; | |
} | |
else | |
{ | |
var news = 0; | |
} | |
var assunto = document.getElementById("assunto").value; | |
var nome = document.getElementById("nome").value; | |
var email = document.getElementById("email").value; | |
var telefone = document.getElementById("telefone").value; | |
var mensagem = document.getElementById("mensagem").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/orcamento.php?action=envia&assunto="+assunto+"&nome="+nome+"&email="+email+"&telefone="+telefone+"&mensagem="+mensagem+"&news="+news; | |
ajaxGet(url,alvo,true); | |
} | |
function orcamento_add(id_pro) | |
{ | |
if(document.getElementById("qtde_ite").value == "") | |
{ | |
alert('Por favor, informe a quantidade.'); | |
document.getElementById("qtde_ite").focus(); | |
return false; | |
} | |
var qtde_ite = document.getElementById('qtde_ite').value; | |
window.location = '/orcamento/'+qtde_ite+'/'+id_pro+'/adicionar-item'; | |
} | |
function legenda_edit(id_fot,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "foto.php?action=legenda_edit&id_fot="+id_fot; | |
ajaxGet(url,alvo,false); | |
} | |
function legenda_update(campo,id_fot,div) | |
{ | |
var desc_fot = document.getElementById(campo).value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "foto.php?action=legenda_update&id_fot="+id_fot+"&desc_fot="+desc_fot; | |
ajaxGet(url,alvo,false); | |
} | |
function del_foto(frase,id_fot,div) | |
{ | |
if(confirm(frase)) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/admin/foto.php?action=del_foto&id_fot="+id_fot+"&div="+div; | |
ajaxGet(url,alvo,false); | |
if(document.getElementById('divFotoIn')) | |
{ | |
document.getElementById('divFotoIn').innerHTML = 'Enviar uma nova foto<br /><input name="arquivo" type="file" class="arquivo" id="arquivo" size="30" /><br />'; | |
} | |
} | |
} | |
function busca_subcategoria(div,id_sub) | |
{ | |
var id_cap = document.getElementById("id_cap").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "produto.php?action=busca_subcategoria&id_cap="+id_cap+"&id_sub="+id_sub; | |
ajaxGet(url,alvo,true); | |
} | |
function simula_tab(objeto,event) | |
{ | |
var tecla = window.event ? event.keyCode : event.which; | |
var CharCode = String.fromCharCode(tecla); | |
if(tecla == 13) | |
{ | |
document.getElementById(objeto).focus(); | |
} | |
} | |
function produto_fotos(id_pro,id_imagem,page,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/produto.php?action=produto_fotos&id_pro="+id_pro+"&id_imagem="+id_imagem+"&page="+page; | |
ajaxGet(url,alvo,false); | |
} | |
function produto_carrega_imagem(id_pro,page,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/produto.php?action=produto_carrega_imagem&id_pro="+id_pro+"&page="+page; | |
ajaxGet(url,alvo,false); | |
} | |
function foto_destaque(id_fot,frase,situacao_fot,div) | |
{ | |
if(confirm(frase)) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "foto.php?action=foto_destaque&id_fot="+id_fot+"&situacao_fot="+situacao_fot+"&div="+div; | |
ajaxGet(url,alvo,true); | |
} | |
} | |
function mostra_esconde_div(opcao,div) | |
{ | |
if(opcao == 1) | |
{ | |
document.getElementById(div).style.visibility = "hidden"; | |
} | |
else | |
{ | |
document.getElementById(div).style.visibility = "visible"; | |
} | |
} | |
function mostra_esconde_div_geral(opcao,div) | |
{ | |
var div_c = document.getElementById(div); | |
if(opcao == 0) | |
{ | |
div_c.style.display = 'none'; | |
} | |
else | |
{ | |
div_c.style.display = ''; | |
} | |
} | |
function video_cadastrar(div) | |
{ | |
if(document.getElementById("desc_vid").value == '') | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("desc_vid").focus(); | |
return false; | |
} | |
if(document.getElementById("url_vid").value == '') | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("url_vid").focus(); | |
return false; | |
} | |
var desc_vid = document.getElementById('desc_vid').value; | |
var url_vid = document.getElementById('url_vid').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "video2.php?action=video_cadastrar&desc_vid="+desc_vid+"&url_vid="+encodeURIComponent(url_vid); | |
ajaxGet(url,alvo,true); | |
} | |
function video_form(div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "video2.php?action=video_form"; | |
ajaxGet(url,alvo,true); | |
} | |
function video_lista(div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "video2.php?action=video_lista"; | |
ajaxGet(url,alvo,true); | |
} | |
function imagens_lista(id_not,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "noticia.php?action=imagens_lista&id_not="+id_not; | |
ajaxGet(url,alvo,true); | |
} | |
function insere_textarea(prefixo,parametro) | |
{ | |
tinyMCE.execCommand('mceInsertContent',false,' '+prefixo+parametro+' '); | |
} | |
function categoria_vinculo(id_cat,id_cat2,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "categoria.php?action=categoria_vinculo&id_cat="+id_cat+"&id_cat2="+id_cat2; | |
ajaxGet(url,alvo,true); | |
} | |
function foto_destaque(id_fot,frase,situacao_fot,div) | |
{ | |
if(confirm(frase)) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "foto.php?action=foto_destaque&id_fot="+id_fot+"&situacao_fot="+situacao_fot+"&div="+div; | |
ajaxGet(url,alvo,true); | |
} | |
} | |
function foto_destaque_mostra(id_fot,situacao_fot,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "foto.php?action=foto_destaque_mostra&id_fot="+id_fot+"&situacao_fot="+situacao_fot+"&div="+div; | |
ajaxGet(url,alvo,true); | |
} | |
function carrega_galeria(id,valor,div,page) | |
{ | |
document.getElementById("divGaleria").innerHTML = ''; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/noticia.php?action=carrega_galeria&id="+id+"&valor="+valor+"&page="+page; | |
ajaxGet(url,alvo,false); | |
} | |
function carrega_mini(id,valor,page,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/noticia.php?action=carrega_mini&id="+id+"&valor="+valor+"&page="+page; | |
ajaxGet(url,alvo,false); | |
} | |
function abre_img(id,valor,page,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/noticia.php?action=abre_img&id="+id+"&valor="+valor+"&page="+page; | |
ajaxGet(url,alvo,false); | |
} | |
// enquete admin | |
function enquete_adm(id_enq,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "enquete.php?action=enquete_adm&id_enq="+id_enq; | |
ajaxGet(url,alvo,true); | |
} | |
function enquete_del(frase,id_opc,id_enq,div) | |
{ | |
if(confirm(frase)) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "enquete.php?action=enquete_del&id_opc="+id_opc+"&id_enq="+id_enq; | |
ajaxGet(url,alvo,true); | |
} | |
} | |
function enquete_add(id_enq,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "enquete.php?action=enquete_add&id_enq="+id_enq; | |
ajaxGet(url,alvo,true); | |
} | |
function enquete_cadastrar(id_enq,div) | |
{ | |
if(document.getElementById("desc_opc").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("desc_opc").focus(); | |
return false; | |
} | |
var desc_opc = document.getElementById("desc_opc").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "enquete.php?action=enquete_cadastrar&id_enq="+id_enq+"&desc_opc="+desc_opc; | |
ajaxGet(url,alvo,true); | |
} | |
function enquete_atualizar(id_opc,id_enq,div) | |
{ | |
if(document.getElementById("desc_opc").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("desc_opc").focus(); | |
return false; | |
} | |
var desc_opc = document.getElementById("desc_opc").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "enquete.php?action=enquete_atualizar&id_opc="+id_opc+"&id_enq="+id_enq+"&desc_opc="+desc_opc; | |
ajaxGet(url,alvo,true); | |
} | |
function enquete_edit(id_opc,id_enq,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "enquete.php?action=enquete_edit&id_opc="+id_opc+"&id_enq="+id_enq; | |
ajaxGet(url,alvo,true); | |
} | |
// enquete usuário | |
function enquete_view(id_enq,mostra_but_fechar,div) | |
{ | |
//document.getElementById("divGaleria").style.height = '350px'; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/enquete.php?action=enquete_view&id_enq="+id_enq+"&mostra_but_fechar="+mostra_but_fechar; | |
ajaxGet(url,alvo,true); | |
} | |
function enquete_resultado(id_enq,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/enquete.php?action=enquete_resultado&id_enq="+id_enq; | |
ajaxGet(url,alvo,true); | |
} | |
function enquete_votar(id_enq,div) | |
{ | |
if(document.getElementById("id_opc").value == "") | |
{ | |
alert('Por favor, selecione uma das alternativas.'); | |
document.getElementById("id_opc").focus(); | |
return false; | |
} | |
var id_opc = document.getElementById("id_opc").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/enquete.php?action=enquete_votar&id_enq="+id_enq+"&id_opc="+id_opc; | |
ajaxGet(url,alvo,true); | |
} | |
function calendario(data,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/agenda.php?action=calendario&data="+data; | |
ajaxGet(url,alvo,false); | |
} | |
function calendario_data(data) | |
{ | |
var dia = data.substr(8,2); | |
var mes = data.substr(5,2); | |
var ano = data.substr(0,4); | |
document.getElementById('data_con').value = dia+'/'+mes+'/'+ano; | |
} | |
function ordenacao_add(id_cat) | |
{ | |
var botao = 'but'+id_cat; | |
var ordenacao = document.getElementById('ordenacao').value; | |
var sequencia = document.getElementById('sequencia').value; | |
if(document.getElementById(botao).value == '( )') | |
{ | |
ordenacao++; | |
document.getElementById('sequencia').value += id_cat+','; | |
document.getElementById('ordenacao').value = ordenacao; | |
document.getElementById(botao).value = '('+ordenacao+')'; | |
document.getElementById(botao).style.backgroundColor='#990000'; | |
document.getElementById(botao).style.color='#FFF'; | |
//document.getElementById(botao).disabled = true; | |
} | |
else | |
{ | |
sequencia = sequencia.replace(''+id_cat+',',''); | |
document.getElementById('sequencia').value = ''+sequencia+''; | |
ordenacao--; | |
document.getElementById('ordenacao').value = ordenacao; | |
document.getElementById(botao).style.backgroundColor='#EAEAEA'; | |
document.getElementById(botao).style.color='#333'; | |
document.getElementById(botao).value = '( )'; | |
} | |
} | |
function busca_principal() | |
{ | |
if((document.getElementById("chave").value.length < 1) || (document.getElementById("chave").value == 'Pesquisar...')) | |
{ | |
alert('Por favor, informe ao menos 1 caracter para a busca.'); | |
document.getElementById("chave").value = ''; | |
document.getElementById("chave").focus(); | |
return false; | |
} | |
else | |
{ | |
var chave = document.getElementById("chave").value; | |
chave = chave.replace("'",'_apostrofo_'); | |
chave = chave.replace("’",'_apostrofo_'); | |
chave = chave.replace("&",'_comercial_'); | |
var url; | |
alvo = document.getElementById('divPesquisaAjax'); | |
url = "/busca.php?action=monta_busca&key="+chave; | |
ajaxGet(url,alvo,false); | |
} | |
} | |
function cadastra_news(div) | |
{ | |
if(document.getElementById("nome").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("nome").focus(); | |
return false; | |
} | |
if(document.getElementById("email").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("email").focus(); | |
return false; | |
} | |
var nome = document.getElementById("nome").value; | |
var email = document.getElementById("email").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/home.php?action=cadastra_news&nome="+nome+"&email="+email; | |
ajaxGet(url,alvo,true); | |
} | |
function cadastra_lancamento(div) | |
{ | |
if(document.getElementById("email_home").value == "" || document.getElementById("email_home").value == 'Preencha aqui seu e-mail') | |
{ | |
alert('Por favor, informe o seu e-mail.'); | |
document.getElementById("email_home").focus(); | |
return false; | |
} | |
var email_home = document.getElementById("email_home").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/lancamento.php?action=cadastra_lancamento&email_home="+email_home; | |
ajaxGet(url,alvo,true); | |
} | |
function cadastra_news_home(div) | |
{ | |
if(document.getElementById("nome_home").value == "" || document.getElementById("nome_home").value == "Nome") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("nome_home").focus(); | |
return false; | |
} | |
if(document.getElementById("email_home").value == "" || document.getElementById("email_home").value == "E-mail") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("email_home").focus(); | |
return false; | |
} | |
var nome_home = document.getElementById("nome_home").value; | |
var email_home = document.getElementById("email_home").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/home.php?action=cadastra_news_home&nome="+nome_home+"&email="+email_home; | |
ajaxGet(url,alvo,true); | |
} | |
function cidade_form(div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "cidade.php?action=cidade_form"; | |
ajaxGet(url,alvo,false); | |
} | |
function cidade_cadastrar(div) | |
{ | |
if(document.getElementById("id_est").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("id_est").focus(); | |
return false; | |
} | |
if(document.getElementById("desc_cid").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("desc_cid").focus(); | |
return false; | |
} | |
var id_est = document.getElementById("id_est").value; | |
var desc_cid = document.getElementById("desc_cid").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "cidade.php?action=cidade_cadastrar&id_est="+id_est+"&desc_cid="+desc_cid; | |
ajaxGet(url,alvo,true); | |
} | |
function cidade_listar(div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "cidade.php?action=cidade_listar"; | |
ajaxGet(url,alvo,false); | |
} | |
function galeria_not(id,valor,colunas,div) | |
{ | |
var colunas = colunas/250; | |
colunas = Math.round(colunas); | |
if(colunas >= 5) | |
{ | |
colunas--; | |
} | |
var url; | |
alvo = document.getElementById(div); | |
url = "/noticia.php?action=galeria_not&id="+id+"&valor="+valor+"&colunas="+colunas; | |
ajaxGet(url,alvo,true); | |
} | |
function mural_insere_emotion(num) | |
{ | |
document.getElementById("mensagem_msg").value += " ::"+num+":: "; | |
document.getElementById("mensagem_msg").focus(); | |
} | |
function limite_caracteres(campo,limite,campo_result) | |
{ | |
if(document.getElementById(campo).value.length >= limite) | |
{ | |
document.getElementById(campo).value = document.getElementById(campo).value.substr(0,limite); | |
} | |
document.getElementById(campo_result).value = limite - document.getElementById(campo).value.length; | |
} | |
function mural_envia(div) | |
{ | |
if(document.getElementById("nome_msg").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("nome_msg").focus(); | |
return false; | |
} | |
/*if(document.getElementById("sobrenome_msg").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("sobrenome_msg").focus(); | |
return false; | |
}*/ | |
if(document.getElementById("cidade_msg").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("cidade_msg").focus(); | |
return false; | |
} | |
if(document.getElementById("estado_msg").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("estado_msg").focus(); | |
return false; | |
} | |
if(document.getElementById("email_msg").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("email_msg").focus(); | |
return false; | |
} | |
if(document.getElementById("mensagem_msg").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("mensagem_msg").focus(); | |
return false; | |
} | |
if(document.getElementById("news").checked == true) | |
{ | |
var news = 1; | |
} | |
else | |
{ | |
var news = 0; | |
} | |
var id_not = document.getElementById("id_not").value; | |
var id_vid = document.getElementById("id_vid").value; | |
var id_pro = document.getElementById("id_pro").value; | |
var nome_msg = document.getElementById("nome_msg").value; | |
var cidade_msg = document.getElementById("cidade_msg").value; | |
var estado_msg = document.getElementById("estado_msg").value; | |
var email_msg = document.getElementById("email_msg").value; | |
var mensagem_msg = document.getElementById("mensagem_msg").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/mural.php?action=envia&nome_msg="+nome_msg+"&cidade_msg="+cidade_msg+"&estado_msg="+estado_msg+"&email_msg="+email_msg+"&mensagem_msg="+mensagem_msg+"&news="+news+"&id_not="+id_not+"&id_vid="+id_vid+"&id_pro="+id_pro; | |
ajaxGet(url,alvo,true); | |
} | |
function mural_form(id_not,id_vid,id_pro,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/mural.php?action=mural_form&id_not="+id_not+"&id_vid="+id_vid+"&id_pro="+id_pro; | |
ajaxGet(url,alvo,false); | |
} | |
function mural_listar(id_not,id_vid,id_pro,page,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/mural.php?action=mural_listar&page="+page+"&id_not="+id_not+"&id_vid="+id_vid+"&id_pro="+id_pro; | |
ajaxGet(url,alvo,false); | |
} | |
function galeria_not(id,valor,colunas,div) | |
{ | |
var colunas = colunas/250; | |
colunas = Math.round(colunas); | |
if(colunas >= 5) | |
{ | |
colunas--; | |
} | |
var url; | |
alvo = document.getElementById(div); | |
url = "/noticia.php?action=galeria_not&id="+id+"&valor="+valor+"&colunas="+colunas; | |
ajaxGet(url,alvo,true); | |
} | |
function galeria_slideshow(id,valor,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/noticia.php?action=galeria_slideshow&id="+id+"&valor="+valor; | |
ajaxGet(url,alvo,true); | |
} | |
function acao_cobranca(acao) | |
{ | |
if(document.getElementById('parametro').value == "") | |
{ | |
alert('Por favor, selecione ao menos uma cobrança.'); | |
document.getElementById('acao').selectedIndex = 0; | |
return false; | |
} | |
if(acao != "") | |
{ | |
if(confirm("Tem certeza que deseja prosseguir?\n\nClique em ok para continuar.")) | |
{ | |
parametro = document.getElementById('parametro').value; | |
window.location='index.php?pagina=cobranca&action=acao&acao='+acao+"¶metro="+parametro; | |
} | |
else | |
{ | |
document.getElementById('acao').selectedIndex = 0; | |
} | |
} | |
} | |
function acao_cobranca_coleta(id_cob) | |
{ | |
if(document.getElementById('parametro').value.indexOf(id_cob+',') == -1) | |
{ | |
document.getElementById('parametro').value += id_cob+','; | |
} | |
else | |
{ | |
var parametro = document.getElementById('parametro').value; | |
parametro = parametro.replace(id_cob+',',''); | |
document.getElementById('parametro').value = parametro; | |
} | |
} | |
function envia_cobranca_form(id_cob,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "cobranca.php?action=envia_cobranca_form&id_cob="+id_cob; | |
ajaxGet(url,alvo,true); | |
} | |
function envia_cobranca(id_cob,div) | |
{ | |
if(document.getElementById('email_cli').value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById('email_cli').focus(); | |
return false; | |
} | |
var email_cli = document.getElementById('email_cli').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "cobranca.php?action=envia_cobranca&id_cob="+id_cob+"&email_cli="+email_cli; | |
ajaxGet(url,alvo,true); | |
} | |
function form_inscricao(div) | |
{ | |
mostra_esconde_div(0,'divFlutuante'); | |
mostra_esconde_div(0,'divFundo'); | |
var url; | |
alvo = document.getElementById(div); | |
url = "cliente.php?action=form_inscricao"; | |
ajaxGet(url,alvo,true); | |
} | |
function form_inscricao_envia(div) | |
{ | |
if(document.getElementById('email_cli').value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById('email_cli').focus(); | |
return false; | |
} | |
var email_cli = document.getElementById('email_cli').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "cliente.php?action=form_inscricao_envia&email_cli="+email_cli; | |
ajaxGet(url,alvo,true); | |
} | |
function servico_cobranca_existente(id_cli,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "servico.php?action=servico_cobranca_existente&id_cli="+id_cli; | |
ajaxGet(url,alvo,true); | |
} | |
function abre_form() | |
{ | |
if(document.getElementById("opcao").value == 1) | |
{ | |
document.getElementById("divInfo").innerHTML = ""; | |
document.getElementById("divF").style.display = ''; | |
document.getElementById("divJ").style.display = 'block'; | |
document.getElementById("divJ").style.display= 'none'; | |
document.getElementById('razao_social_cli').value = ''; | |
document.getElementById('nome_fantasia_cli').value = ''; | |
document.getElementById('cnpj_cli').value = ''; | |
} | |
else | |
{ | |
document.getElementById("divInfo").innerHTML = "<br /><strong>Informações sobre a Empresa</strong><br /><br />"; | |
document.getElementById("divF").style.display = ''; | |
document.getElementById("divJ").style.display = ''; | |
} | |
} | |
function servico_renovacao(div) | |
{ | |
if((document.getElementById('data_renovacao_ite').value.length == 10) && (document.getElementById('data_renovacao_ite').value != '00/00/0000') && (document.getElementById('num_meses_ite').value != '') && (document.getElementById('num_meses_ite').value != '0')) | |
{ | |
var data_renovacao_ite = document.getElementById('data_renovacao_ite').value; | |
var num_meses_ite = document.getElementById('num_meses_ite').value; | |
var id_ser = document.getElementById('id_ser').value; | |
var desconto_ite = document.getElementById('desconto_ite').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "servico.php?action=servico_renovacao&data_renovacao_ite="+data_renovacao_ite+"&num_meses_ite="+num_meses_ite+"&id_ser="+id_ser+"&desconto_ite="+desconto_ite; | |
ajaxGet(url,alvo,false); | |
} | |
else | |
{ | |
document.getElementById('proxima_renovacao').value = 'Indeterminado.'; | |
document.getElementById('valor_cobranca').value = '0,00'; | |
} | |
} | |
function busca_servico(id_ser,div) | |
{ | |
if(id_ser != "") | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "servico.php?action=busca_servico&id_ser="+id_ser; | |
ajaxGet(url,alvo,false); | |
} | |
} | |
function abre_form_config() | |
{ | |
if(document.getElementById("opcao").value == 1) | |
{ | |
document.getElementById("divF").style.display = ''; | |
document.getElementById("divJ").style.display = 'block'; | |
document.getElementById("divJ").style.display= 'none'; | |
} | |
else | |
{ | |
document.getElementById("divF").style.display = 'block'; | |
document.getElementById("divF").style.display = 'none'; | |
document.getElementById("divJ").style.display = ''; | |
} | |
} | |
function guia_contato_form(id_cli,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/vitrine.php?action=guia_contato_form&id_cli="+id_cli; | |
ajaxGet(url,alvo,true); | |
} | |
function guia_contato_envia(id_gui,div) | |
{ | |
if(document.getElementById("nome").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("nome").focus(); | |
return false; | |
} | |
if(document.getElementById("email").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("email").focus(); | |
return false; | |
} | |
if(document.getElementById("telefone").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("telefone").focus(); | |
return false; | |
} | |
if(document.getElementById("mensagem").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("mensagem").focus(); | |
return false; | |
} | |
if(document.getElementById("news").checked == true) | |
{ | |
var news = 1; | |
} | |
else | |
{ | |
var news = 0; | |
} | |
var nome = document.getElementById("nome").value; | |
var email = document.getElementById("email").value; | |
var telefone = document.getElementById("telefone").value; | |
var mensagem = document.getElementById("mensagem").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/vitrine.php?action=guia_contato_envia&id_cli="+id_cli+"&nome="+nome+"&email="+email+"&telefone="+telefone+"&mensagem="+mensagem+"&news="+news; | |
ajaxGet(url,alvo,true); | |
} | |
function galeria_nova(id_pro,div) | |
{ | |
mostra_esconde_div(0,'divFundo'); | |
mostra_esconde_div(0,'divGaleriaNova'); | |
var url; | |
alvo = document.getElementById(div); | |
url = "/produto.php?action=galeria_nova&id_pro="+id_pro; | |
ajaxGet(url,alvo,true); | |
} | |
function galeria_nova_foto(id_pro,page,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/produto.php?action=galeria_nova_foto&id_pro="+id_pro+"&page="+page; | |
ajaxGet(url,alvo,false); | |
} | |
function galeria_nova_miniaturas(id_pro,page,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/produto.php?action=galeria_nova_miniaturas&id_pro="+id_pro+"&page="+page; | |
ajaxGet(url,alvo,false); | |
} | |
function identificacao(id_pro,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/sorteio.php?action=identificacao&div="+div+"&id_pro="+id_pro; | |
ajaxGet(url,alvo,false); | |
} | |
function participar(cadastro_novo,id_pro,div) | |
{ | |
if(cadastro_novo == 1) | |
{ | |
if(document.getElementById("nome").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("nome").focus(); | |
return false; | |
} | |
if(document.getElementById("sobrenome").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("sobrenome").focus(); | |
return false; | |
} | |
if(document.getElementById("email_cli").value.length < 6) | |
{ | |
alert('Atenção! O campo e-mail deve conter no mínimo 6 caracteres.'); | |
document.getElementById("email_cli").focus(); | |
return false; | |
} | |
if(document.getElementById("telefone_cli").value.indexOf('(11)') >= 0) | |
{ | |
if(document.getElementById("telefone_cli").value.length < 15) | |
{ | |
alert('Atenção, este campo requer 15 dígitos.'); | |
document.getElementById("telefone_cli").focus(); | |
return false; | |
} | |
} | |
else | |
{ | |
if(document.getElementById("telefone_cli").value.length < 14) | |
{ | |
alert('Atenção, este campo requer 14 dígitos.'); | |
document.getElementById("telefone_cli").focus(); | |
return false; | |
} | |
} | |
var nome_cli = document.getElementById('nome').value+' '+document.getElementById('sobrenome').value; | |
var telefone_cli = document.getElementById('telefone_cli').value; | |
var email_cli = document.getElementById('email_cli').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/sorteio.php?action=participar&div="+div+"&email_cli="+email_cli+"&id_pro="+id_pro+"&cadastro_novo="+cadastro_novo+"&nome_cli="+nome_cli+"&telefone_cli="+telefone_cli; | |
ajaxGet(url,alvo,false); | |
} | |
else | |
{ | |
if(document.getElementById("email_cli").value.length < 6) | |
{ | |
alert('Atenção! O campo e-mail deve conter no mínimo 6 caracteres.'); | |
document.getElementById("email_cli").focus(); | |
return false; | |
} | |
var email_cli = document.getElementById('email_cli').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/sorteio.php?action=participar&div="+div+"&email_cli="+email_cli+"&id_pro="+id_pro+"&cadastro_novo="+cadastro_novo; | |
ajaxGet(url,alvo,false); | |
} | |
document.getElementById('botao1').disabled = true;document.getElementById('botao1').value = 'Aguarde...'; | |
} | |
function gera_senha(div) | |
{ | |
var nome_rep = document.getElementById("nome_rep").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "representante.php?action=gera_senha&nome_rep="+nome_rep; | |
ajaxGet(url,alvo,false); | |
} | |
function envia_senha(id_rep,frase,div) | |
{ | |
if(confirm(frase)) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "representante.php?action=envia_senha&id_rep="+id_rep; | |
ajaxGet(url,alvo,false); | |
} | |
} | |
function envia_senha_representante(div) | |
{ | |
if(document.getElementById("email2_rep").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("email2_rep").focus(); | |
return false; | |
} | |
var email_rep = document.getElementById("email2_rep").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/restrito.php?action=envia_senha_representante&email_rep="+email_rep; | |
ajaxGet(url,alvo,true); | |
} | |
function envia_senha_usuario(div) | |
{ | |
if(document.getElementById("email2_usu").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("email2_usu").focus(); | |
return false; | |
} | |
var email_usu = document.getElementById("email2_usu").value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/restrito.php?action=envia_senha_usuario&email_usu="+email_usu; | |
ajaxGet(url,alvo,true); | |
} | |
function representante(id_est,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/representante.php?action=representante&id_est="+id_est; | |
ajaxGet(url,alvo,false); | |
} | |
function noticia_view(data_not,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/noticia.php?action=noticia_view&data_not="+data_not; | |
ajaxGet(url,alvo,true); | |
} | |
function marcacao_lista(opcao,campo) | |
{ | |
for(i=0;i<document.getElementById("form1").elements.length;i++) | |
{ | |
if(document.getElementById("form1").elements[i].id == campo) | |
{ | |
if(document.getElementById("form1").elements[i].disabled == false) | |
{ | |
document.getElementById("form1").elements[i].checked = opcao; | |
} | |
} | |
} | |
} | |
function marcacao(opcao,campo) | |
{ | |
for(i=0;i<document.getElementById("form1").elements.length;i++) | |
{ | |
if(document.getElementById("form1").elements[i].name == campo) | |
{ | |
if(document.getElementById("form1").elements[i].disabled == false) | |
{ | |
document.getElementById("form1").elements[i].checked = opcao; | |
} | |
} | |
} | |
} | |
function busca_desconto(div) | |
{ | |
var id_cli = document.getElementById('id_cli').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/admin/pedido.php?action=busca_desconto&id_cli="+id_cli; | |
ajaxGet(url,alvo,true); | |
} | |
function pedido_produto_listar(id_ped,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/admin/pedido.php?action=pedido_produto_listar&id_ped="+id_ped; | |
ajaxGet(url,alvo,true); | |
} | |
function busca_produto_pedido_form(div) | |
{ | |
if(document.getElementById('id_cli').value == "") | |
{ | |
alert('Por favor, selecione um cliente.'); | |
document.getElementById("id_cli").focus(); | |
mostra_esconde_div(1,'divFlutuante'); | |
mostra_esconde_div(1,'divFundo'); | |
return false; | |
} | |
var id_cli = document.getElementById('id_cli').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/admin/pedido.php?action=busca_produto_pedido_form&id_cli="+id_cli; | |
ajaxGet(url,alvo,false); | |
} | |
function busca_produto_pedido(chave,div) | |
{ | |
chave = chave.replace("'",'_apostrofo_'); | |
chave = chave.replace("’",'_apostrofo_'); | |
chave = chave.replace("&",'_comercial_'); | |
var id_cli = document.getElementById('id_cli').value; | |
var id_des = document.getElementById('id_des').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/admin/pedido.php?action=busca_produto_pedido&key="+chave+"&id_cli="+id_cli+"&id_des="+id_des; | |
ajaxGet(url,alvo,false); | |
} | |
function pedido_produto_add(id_pro,div) | |
{ | |
var id_des = document.getElementById('id_des').value; | |
var id_cli = document.getElementById('id_cli').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/admin/pedido.php?action=pedido_produto_add&id_pro="+id_pro+"&id_des="+id_des+"&id_cli="+id_cli; | |
ajaxGet(url,alvo,true); | |
} | |
function pedido_produto_cadastrar(id_pro,div) | |
{ | |
var id_tec = ''; | |
var id_aca = ''; | |
document.getElementById('divFlutuanteTitulo').innerHTML = 'Por favor, aguarde...'; | |
if(document.getElementById("qtde_itp").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("qtde_itp").focus(); | |
return false; | |
} | |
if(document.getElementById('id_tec')) | |
{ | |
if(document.getElementById("id_tec").value == "") | |
{ | |
alert('Por favor, selecione um tipo de tecido.'); | |
document.getElementById("id_tec").focus(); | |
return false; | |
} | |
id_tec = document.getElementById('id_tec').value; | |
} | |
if(document.getElementById('id_aca')) | |
{ | |
if(document.getElementById("id_aca").value == "") | |
{ | |
alert('Por favor, selecione um tipo de acabamento.'); | |
document.getElementById("id_aca").focus(); | |
return false; | |
} | |
id_aca = document.getElementById('id_aca').value; | |
} | |
var id_ped = document.getElementById('id_ped').value; | |
var desconto_itp = document.getElementById('desconto_itp').value; | |
var preco_itp = document.getElementById('preco_itp').value; | |
var qtde_itp = document.getElementById('qtde_itp').value; | |
var obs_itp = document.getElementById('obs_itp').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/admin/pedido.php?action=pedido_produto_cadastrar&id_ped="+id_ped+"&id_pro="+id_pro+"&desconto_itp="+desconto_itp+"&qtde_itp="+qtde_itp+"&preco_itp="+preco_itp+"&obs_itp="+obs_itp+"&id_tec="+id_tec+"&id_aca="+id_aca; | |
ajaxGet(url,alvo,true); | |
} | |
function pedido_produto_excluir(id_itp,frase,div) | |
{ | |
if(confirm(frase)) | |
{ | |
var id_ped = document.getElementById('id_ped').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/admin/pedido.php?action=pedido_produto_excluir&id_itp="+id_itp+"&id_ped="+id_ped; | |
ajaxGet(url,alvo,true); | |
} | |
} | |
function imprimir(opcao) | |
{ | |
if(document.getElementById('divPrint')) | |
{ | |
if(opcao == 1) | |
{ | |
mostra_esconde_div_geral(1,'divPrint'); | |
mostra_esconde_div_geral(0,'divPrint2'); | |
} | |
else | |
{ | |
mostra_esconde_div_geral(0,'divPrint'); | |
mostra_esconde_div_geral(1,'divPrint2'); | |
} | |
} | |
} | |
function valida_forma_pgt(id_pgt,div) | |
{ | |
var total = document.getElementById('total').value; | |
if(total <= 0) | |
{ | |
alert('Por favor, primeiramente adicione itens ao seu pedido.'); | |
document.getElementById('id_pgt').selectedIndex = 0; | |
} | |
else | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/admin/pedido.php?action=valida_forma_pgt&total="+total+"&id_pgt="+id_pgt; | |
ajaxGet(url,alvo,true); | |
} | |
} | |
function slide_movimento(id) | |
{ | |
var img = id; | |
var top = 100; | |
var top2 = (top*2); | |
var num = 0; | |
var operacao = 'subtracao'; | |
objInter = setInterval(function(){ | |
if(num <= top && operacao == 'subtracao') | |
{ | |
num++; | |
document.getElementById(img).style.marginTop = '-'+num+'px'; | |
if(num == top) | |
{ | |
operacao = 'adicao'; | |
} | |
} | |
else if(operacao == 'adicao') | |
{ | |
num--; | |
document.getElementById(img).style.marginTop = '-'+num+'px'; | |
if(num == 0) | |
{ | |
operacao = 'subtracao'; | |
} | |
} | |
if(document.getElementById('teste')) | |
{ | |
//document.getElementById('teste').value = num; | |
} | |
}, 40); | |
} | |
function muda_posicao_menu(menu) | |
{ | |
var posicao = 0; | |
if(menu == 2) | |
{ | |
posicao = 99; | |
} | |
if(menu == 3) | |
{ | |
posicao = 246; | |
} | |
if(menu == 4) | |
{ | |
posicao = 356; | |
} | |
if(menu == 5) | |
{ | |
posicao = 552; | |
} | |
if(posicao == 0) | |
{ | |
document.getElementById('divM2').style.visibility = 'hidden'; | |
} | |
else | |
{ | |
document.getElementById('divM2').style.visibility = ''; | |
} | |
document.getElementById('divM2').style.left = posicao+'px'; | |
} | |
function representante_mapa(id_est,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "representante.php?action=representante_mapa&id_est="+id_est; | |
ajaxGet(url,alvo,true); | |
} | |
function loja_mapa(id_est,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "onde-comprar.php?action=loja_mapa&id_est="+id_est; | |
ajaxGet(url,alvo,true); | |
} | |
function slide_movimento(id) | |
{ | |
var img = id; | |
var top = 100; | |
var top2 = (top*2); | |
var num = 0; | |
var operacao = 'subtracao'; | |
objInter = setInterval(function(){ | |
if(num <= top && operacao == 'subtracao') | |
{ | |
num++; | |
document.getElementById(img).style.marginTop = '-'+num+'px'; | |
if(num == top) | |
{ | |
operacao = 'adicao'; | |
} | |
} | |
else if(operacao == 'adicao') | |
{ | |
num--; | |
document.getElementById(img).style.marginTop = '-'+num+'px'; | |
if(num == 0) | |
{ | |
operacao = 'subtracao'; | |
} | |
} | |
}, 40); | |
} | |
function valida_senha(div) | |
{ | |
if(document.getElementById("senha_sen").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("senha_sen").focus(); | |
return false; | |
} | |
var senha_sen = document.getElementById('senha_sen').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/produto.php?action=valida_senha&senha_sen="+senha_sen; | |
ajaxGet(url,alvo,true); | |
} | |
function validaCnpj(cnpj) | |
{ | |
var erro = 0; | |
cnpj = cnpj.replace(/[^\d]+/g,''); | |
if(cnpj == '') erro++; | |
if (cnpj.length != 14) | |
erro++; | |
// Elimina CNPJs invalidos conhecidos | |
if (cnpj == "00000000000000" || | |
cnpj == "11111111111111" || | |
cnpj == "22222222222222" || | |
cnpj == "33333333333333" || | |
cnpj == "44444444444444" || | |
cnpj == "55555555555555" || | |
cnpj == "66666666666666" || | |
cnpj == "77777777777777" || | |
cnpj == "88888888888888" || | |
cnpj == "99999999999999") | |
erro++; | |
// Valida DVs | |
tamanho = cnpj.length - 2 | |
numeros = cnpj.substring(0,tamanho); | |
digitos = cnpj.substring(tamanho); | |
soma = 0; | |
pos = tamanho - 7; | |
for (i = tamanho; i >= 1; i--) { | |
soma += numeros.charAt(tamanho - i) * pos--; | |
if (pos < 2) | |
pos = 9; | |
} | |
resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; | |
if (resultado != digitos.charAt(0)) | |
erro++; | |
tamanho = tamanho + 1; | |
numeros = cnpj.substring(0,tamanho); | |
soma = 0; | |
pos = tamanho - 7; | |
for (i = tamanho; i >= 1; i--) { | |
soma += numeros.charAt(tamanho - i) * pos--; | |
if (pos < 2) | |
pos = 9; | |
} | |
resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; | |
if (resultado != digitos.charAt(1)) | |
erro++; | |
if(erro > 0) | |
{ | |
alert('O CNPJ informado é inválido, por favor, redigite.'); | |
return erro; | |
} | |
else | |
{ | |
return erro; | |
} | |
} | |
function icone(opcao) | |
{ | |
document.getElementById('ico_pro').value = opcao; | |
} | |
function valida_mural() | |
{ | |
if(document.getElementById("nome_msg").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("nome_msg").focus(); | |
return false; | |
} | |
if(document.getElementById("email_msg").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("email_msg").focus(); | |
return false; | |
} | |
if(document.getElementById("mensagem_msg").value == "") | |
{ | |
alert('Por favor, preencha os campos obrigatórios.'); | |
document.getElementById("mensagem_msg").focus(); | |
return false; | |
} | |
setTimeout("mural('divComentarioSite');",1000); | |
} | |
function mural(div) | |
{ | |
var endereco_msg = ''; | |
if(document.getElementById('endereco_msg')) | |
{ | |
endereco_msg = document.getElementById('endereco_msg').value; | |
} | |
var id_vid = document.getElementById('id_vid').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/index.php?action=mural&endereco_msg="+endereco_msg+"&id_vid="+id_vid; | |
ajaxGet(url,alvo,false); | |
} | |
function responder(id_msg,usuario) | |
{ | |
$('#comentario').animate({ scrollTop: '550px' }); | |
document.getElementById('mensagem_msg').focus(); | |
document.getElementById('id_msg2').value = id_msg; | |
document.getElementById('resposta').innerHTML = 'Para: <strong>'+usuario+'</strong> <a href="javascript:limpar_resposta();"><img src="/imagens/nao.png" height="15"></strong></a>'; | |
} | |
function limpar_resposta() | |
{ | |
document.getElementById('id_msg2').value = ''; | |
document.getElementById('resposta').innerHTML = ''; | |
} | |
function emotion() | |
{ | |
if(document.getElementById('divEmotion').style.display == 'none') | |
{ | |
mostra_esconde_div_geral(1,'divEmotion'); | |
} | |
else | |
{ | |
mostra_esconde_div_geral(0,'divEmotion'); | |
} | |
} | |
function valida_identificacao() | |
{ | |
if(document.getElementById("nome_home").value == "" || document.getElementById("nome_home").value == 'Primeiro nome') | |
{ | |
alert('Por favor, informe o seu primeiro nome.'); | |
document.getElementById('nome_home').value = ''; | |
document.getElementById("nome_home").focus(); | |
return false; | |
} | |
if(document.getElementById("email_home").value == "" || document.getElementById("email_home").value == 'Seu e-mail') | |
{ | |
alert('Por favor, informe o seu e-mail.'); | |
document.getElementById('email_home').value = ''; | |
document.getElementById("email_home").focus(); | |
return false; | |
} | |
} | |
function valida_identificacao2() | |
{ | |
if(document.getElementById("email_home").value == "") | |
{ | |
alert('Por favor, informe o seu e-mail.'); | |
document.getElementById("email_home").focus(); | |
return false; | |
} | |
if(document.getElementById("senha_home").value == "") | |
{ | |
alert('Por favor, informe sua senha.'); | |
document.getElementById("senha_home").focus(); | |
return false; | |
} | |
} | |
function senha_envia(div) | |
{ | |
if(document.getElementById("email_home").value == "") | |
{ | |
alert('Por favor, informe o seu e-mail.'); | |
document.getElementById("email_home").focus(); | |
return false; | |
} | |
var email_ema = document.getElementById('email_home').value; | |
var url; | |
alvo = document.getElementById(div); | |
url = "/index2.php?action=senha_envia&email_ema="+email_ema; | |
ajaxGet(url,alvo,true); | |
} | |
function foco(elemento) | |
{ | |
if(document.getElementById(elemento)) | |
{ | |
document.getElementById(elemento).focus(); | |
} | |
} | |
function obs_vid(id_vid,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/index.php?action=obs_vid&id_vid="+id_vid; | |
ajaxGet(url,alvo,false); | |
} | |
function foto_destaque_todas(situacao_fot,frase,where,div) | |
{ | |
if(confirm(frase)) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "foto.php?action=foto_destaque_todas&situacao_fot="+situacao_fot+"&where="+where; | |
ajaxGet(url,alvo,true); | |
} | |
} | |
function area_entra(id_are,div) | |
{ | |
var url; | |
alvo = document.getElementById(div); | |
url = "/index2.php?action=area_entra&id_are="+id_are; | |
ajaxGet(url,alvo,true); | |
} | |
function ajax(but_link,url_endereco,carregador,div) | |
{ | |
$(document).ready(function(){ | |
if(carregador != '') | |
{ | |
$('#loading').show(); | |
} | |
$("#"+div+"").empty(); | |
$.ajax({ | |
url: url_endereco, | |
type: "POST", // Type of request to be send, called as method | |
data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values) | |
contentType: false, // The content type used when sending data to the server. | |
cache: false, // To unable request pages to be cached | |
processData:false, // To send DOMDocument or non processed data file it is set to false | |
success: function(data) // A function to be called if request succeeds | |
{ | |
if(carregador != '') | |
{ | |
$('#loading').hide(); | |
} | |
$("#"+div+"").html(data); | |
} | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment