var dirSite = 'https://'+location.host+'/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 changeLogin(ativo){ window.document.getElementById('btn_area_cliente').className = 'btn_area'; window.document.getElementById('btn_representante').className = 'btn_area'; window.document.getElementById('btn_'+ativo).className = 'btn_area_ativo'; window.document.getElementById('form_area_cliente').style.display = 'none'; window.document.getElementById('form_representante').style.display = 'none'; window.document.getElementById('form_'+ativo).style.display = 'block'; } function updateProduto(id){ var valor = getID('produto_'+id).value; var cor = getID('produto_cor_'+id).value; var idProd = getID('produto_id_'+id).value; var ajax = openAjax(); ajax.open('GET', dirSite+'prcss_pedido.php?id='+idProd+'&valor='+valor+'&op=upd&cor='+cor, true); ajax.onreadystatechange = function() { if (ajax.readyState < 4) {} if (ajax.readyState == 4) { if (ajax.status == 200) { window.location.reload();} } } ajax.send(null); } function updateCommm(id){ var valor = getID(id).value; var ajax = openAjax(); ajax.open('GET', dirSite+'prcss_comentario.php?valor='+valor, true); ajax.onreadystatechange = function() { if (ajax.readyState < 4) {} if (ajax.readyState == 4) { if (ajax.status == 200) { setTimeout(function(){ window.location.reload(); }, 3000); } } } ajax.send(null); } function deleteProduto(id){ var valor = getID('produto_'+id).value; location.href= dirSite+'prcss_pedido.php?id='+id+'&valor='+valor+'&op=del'; /* var ajax = openAjax(); ajax.open('GET', dirSite+'prcss_pedido.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 getCidade() { var dest = getID('return_cidade'); var estado = getID('estado').value; var ajax = openAjax(); ajax.open('GET', dirSite+'_prcss/getCidade.php?estado='+estado, true); ajax.onreadystatechange = function() { if (ajax.readyState < 4) { //dest.innerHTML = ''; } if (ajax.readyState == 4) { if (ajax.status == 200) { dest.innerHTML = ajax.responseText;} } } ajax.send(null); }