var dirSite = 'https://www.hilouniformesprofissionais.com.br/site//'; function openAjax() { var ajax; try { ajax = new XMLHttpRequest();} catch(ee) { try { ajax = new ActiveXObject('Msxml2.XMLHTTP');} catch(e) { try { ajax = new ActiveXObject('Microsoft.XMLHTTP');} catch(E) { ajax = false; } } } return ajax;} function getID(ID) { return document.getElementById(ID);}// JavaScript Document function showDiv(obj){ var tmp = window.document.getElementById(obj); if(tmp.style.display == 'none'){ tmp.style.display = ''; } else if(tmp.style.display == ''){ tmp.style.display = 'none'; } } function updateProduto(id){ var valor = getID('produto_'+id).value; location.href = dirSite+'orcamento/index.php?id='+id+'&valor='+valor+'&op=upd'; /* var ajax = openAjax(); ajax.open('GET', dirSite+'orcamento/index.php?id='+id+'&valor='+valor+'&op=upd', true); ajax.onreadystatechange = function() { if (ajax.readyState < 4) {} if (ajax.readyState == 4) { if (ajax.status == 200) { //window.location.reload(); } } } ajax.send(null); */ } function deleteProduto(id){ var valor = getID('produto_'+id).value; location.href = dirSite+'orcamento/index.php?id='+id+'&valor='+valor+'&op=del'; /* var ajax = openAjax(); ajax.open('GET', dirSite+'orcamento/index.php?id='+id+'&valor='+valor+'&op=del', true); ajax.onreadystatechange = function() { if (ajax.readyState < 4) {} if (ajax.readyState == 4) { if (ajax.status == 200) { //window.location.reload(); } } } ajax.send(null); */ } function getFrete() { var dest = getID('return_frete'); var cep = getID('cep').value; var ajax = openAjax(); ajax.open('GET', dirSite+'orcamento/_prcss/getCalcFrete.php?cep='+cep, true); ajax.onreadystatechange = function() { if (ajax.readyState < 4) { dest.innerHTML = 'Carregando....';} if (ajax.readyState == 4) { if (ajax.status == 200) { dest.innerHTML = ajax.responseText; } } } ajax.send(null); } function getCupom(){ var dest = getID('return_cupom'); var cp = getID('cupom'); var cupom = cp.value; var ajax = openAjax(); ajax.open('GET', dirSite+'orcamento/_prcss/Descontos.php?cupom='+cupom, true); ajax.onreadystatechange = function() { if (ajax.readyState == 1) { dest.innerHTML = 'Carregando....';} if (ajax.readyState == 4) { if (ajax.status == 200) { dest.innerHTML = ajax.responseText; getCalculoValor('cupom'); } } } ajax.send(null); } function freteSelect(tipo){ var dest = getID('return_session'); var ajax = openAjax(); var frete = window.document.getElementById(tipo).value; ajax.open('GET', dirSite+'orcamento/_prcss/gravaFrete.php?frete='+frete+'&tipo='+tipo, true); ajax.onreadystatechange = function() { if (ajax.readyState < 4) {} if (ajax.readyState == 4) { if (ajax.status == 200) { getCalculoValor('frete'); } } } ajax.send(null); } function getCalculoValor(origem){ var total = window.document.getElementById('total_pedido').value; var dest = getID('return_total'); dest.innerHTML = 'Calculando....'; var ajax = openAjax(); ajax.open('GET', dirSite+'orcamento/_prcss/getCalculoTotal.php?total='+total, true); ajax.onreadystatechange = function() { if (ajax.readyState == 1) { } if (ajax.readyState == 4) { if (ajax.status == 200) { dest.innerHTML = ajax.responseText; if(origem == 'frete'){ window.document.getElementById('btn_finalizar_pedido').disabled = false; window.document.getElementById('btn_finalizar_pedido').className = 'medium button'; } } } } ajax.send(null); } function gravaObs(){ var observacao = window.document.getElementById('pedidoObservacoes').value; var ajax = openAjax(); ajax.open('GET', dirSite+'orcamento/_prcss/observaSession.php?obs='+observacao, true); ajax.onreadystatechange = function() { if (ajax.readyState < 4) { return (null); } if (ajax.readyState == 4) { if (ajax.status == 200) { return (null); } } } ajax.send(null); } function setPagamento(tipo,pedido){ var retorno = window.document.getElementById('retornoPagamento'); var ajax = openAjax(); ajax.open('GET', dirSite+'orcamento/_prcss/setMeioPagamento.php?tipo='+tipo+'&pedido='+pedido, true); ajax.onreadystatechange = function() { if (ajax.readyState < 4) { return (null); } if (ajax.readyState == 4) { if (ajax.status == 200) { retorno.innerHTML = ajax.responseText; } } } ajax.send(null); }