function ConfirmaOpcao(idProduto, nQtde) { var nComplemento = ""; var oInput = document.getElementsByTagName("INPUT"); nItem = 0; cDescricao = ""; for (nCont = 0; nCont < oInput.length; nCont++) { var item = oInput[nCont]; if (item.type == 'radio') { if (item.name == 'chkitem') { if (item.checked) { nItem = item.id; cDescricao = item.value; } } } } if (nItem == 0) { alert("Por favor escolha o modelo"); return false; } else { if (confirm("Você escolheu " + cDescricao + ", Confirma colocar no carrinho?") == true) { var cParametros; cParametros = idProduto + "&complemento=" + nItem + "&descricao=" + encodeHtml(cDescricao) + "&qtde=" + nQtde; enviaPagina('EnviaCarrinho.asp', 'POST', 'true', 'conteudo', cParametros); } } } function FechaPedidoDeposito(nPedido) { if (confirm("Você escolheu depósito como forma de pagamento, confirma o encerramento do pedido?") == true) { //alert("Pedido Finalizado"); var nFormaPagto = 0 var oInput = document.getElementsByTagName("INPUT"); for (nCont = 0; nCont < oInput.length; nCont++) { var item = oInput[nCont]; if (item.type == 'radio') { if (item.name == 'optDeposito') { if (item.checked) { nFormaPagto = item.value; break; } } } } var cParametros; cParametros = "cdFormaPagto=" + nFormaPagto + "&pedido=" + nPedido; enviaPagina('FechaPedidoDeposito.asp', 'POST', 'true', 'conteudo', cParametros); } } function FechaPedidoBoleto(nPedido) { if (confirm("Você escolheu Boleto Bancário como forma de pagamento, confirma o encerramento do pedido?") == true) { //alert("Pedido Finalizado"); var nFormaPagto = 0 var oInput = document.getElementsByTagName("INPUT"); for (nCont = 0; nCont < oInput.length; nCont++) { var item = oInput[nCont]; if (item.type == 'radio') { if (item.name == 'optBoleto') { if (item.checked) { nFormaPagto = item.value; break; } } } } var cParametros; cParametros = "cdFormaPagto=" + nFormaPagto + "&pedido=" + nPedido; enviaPagina('FechaPedidoBoleto.asp', 'POST', 'true', 'conteudo', cParametros); } } function FechaPedidoCartao(nPedido, nTab) { var cData = new Date(); var cDiaAtual = cData.getDate(); var cMes = cData.getMonth() + 1; var cAno = cData.getYear(); var cBandeira = eval('document.getElementById("txtSigla' + nTab + '").value;'); var nFormaPagto = eval('document.getElementById("txtCartaoFormaPagto' + nTab + '").value;'); var cNomeCartao = eval('document.getElementById("txtNomeCartao' + nTab + '").value;'); var cNumeroCartao = eval('document.getElementById("txtNumeroCartao' + nTab + '").value;'); var cCodigoCartao = eval('document.getElementById("txtCodigoCartao' + nTab + '").value;'); var cMesValidade = eval('document.getElementById("cmbMes' + nTab + '").options(document.getElementById("cmbMes' + nTab + '").selectedIndex).value;'); var cAnoValidade = eval('document.getElementById("cmbAno' + nTab + '").options(document.getElementById("cmbAno' + nTab + '").selectedIndex).value;'); var cParcela = eval('document.getElementById("cmbParcelamento' + nTab + '").options(document.getElementById("cmbParcelamento' + nTab + '").selectedIndex).value;'); var bValida = true; if (cNomeCartao.trim() == "" && bValida == true) { alert("Por favor informe seu nome como está gravado no cartão"); eval('document.getElementById("txtNomeCartao' + nTab + '").focus();'); bValida = false; } if (cNumeroCartao.trim() == "" && bValida == true) { alert("Por favor informe o número do seu cartão"); bValida = false; } if (cCodigoCartao.trim() == "" && bValida == true) { alert("Por favor informe o código de segurança do seu cartão"); eval('document.getElementById("txtCodigoCartao' + nTab + '").focus();'); bValida = false; } if (cParcela.trim() == "") { alert("Por favor informe a parcela"); bValida = false; } if (cMesValidade.trim() == "" && bValida == true) { alert("Por favor informe o mês de validade do seu cartão"); eval('document.getElementById("cmbMes' + nTab + '").focus();'); bValida = false; } if (cAnoValidade.trim() == "" && bValida == true) { alert("Por favor informe o ano de validade do seu cartão"); eval('document.getElementById("cmbAno' + nTab + '").focus();'); bValida = false; } if (parseInt(cAno) == parseInt(cAnoValidade) && parseInt(cMesValidade) < parseInt(cMes) && bValida == true) { alert("Data de validade do cartão vencida"); bValida = false; } if (bValida == true) { if (confirm("Você escolheu o Cartão " + cBandeira + " como forma de pagamento, \n Confirma o encerramento do pedido?") == true) { var cParametros; cParametros = "cdFormaPagto=" + nFormaPagto + "&pedido=" + nPedido; cParametros += "&cBandeira=" + encodeHtml(cBandeira) + "&cNomeCartao=" + encodeHtml(cNomeCartao) + "&cNumeroCartao=" + cNumeroCartao; cParametros += "&cCodigoCartao=" + cCodigoCartao + "&cMesValidade=" + encodeHtml(cMesValidade) + "&cAnoValidade=" + cAnoValidade; cParametros += "&cParcela=" + cParcela; enviaPagina('FechaPedidoCartao.asp', 'POST', 'true', 'conteudo', cParametros); } } } function FechaPedido() { var nComplemento = ""; var bValida = true; var oInput = document.getElementsByTagName("INPUT"); nItem = 0; for (nCont = 0; nCont < oInput.length; nCont++) { var item = oInput[nCont]; if (item.type == 'radio') { if (item.name == 'optEndereco') { if (item.checked) { nItem = item.id; bValida == false; break; } } } } if (nItem == 0 && bValida == true) { alert("Por favor escolha o Endereço de Entrega"); bValida = false; } if (bValida == true) { var oInput = document.getElementsByTagName("INPUT"); nFormaEntrega = 0; var nIndex = 0; for (nCont = 0; nCont < oInput.length; nCont++) { var item = oInput[nCont]; if (item.type == 'radio') { if (item.name == 'optFormaEntrega') { nIndex += 1; if (item.checked) { nFormaEntrega = item.id; bValida = false; break; } } } } if (nItem == 0 && bValida == true) { alert("Por favor escolha o Endereço de Entrega"); bValida = false; } if (nFormaEntrega == 0 && nIndex > 0 && bValida == true) { alert("Por favor escolha o Endereço de Entrega"); bValida = false; } if (bValida == true); { var cParametros; cParametros = "endereco=" + nItem + "&forma_entrega=" + nFormaEntrega; enviaPagina('FechaPedido.asp', 'POST', 'true', 'conteudo', cParametros); } } } function Recalcula(cCampo, cModo) { var nQtde = document.getElementById(cCampo).value; var nCarrinho = cCampo.substring(10); enviaPagina('recalcula.asp', 'POST', 'true', 'conteudo', 'qtde=' + nQtde + '&c=' + nCarrinho + '&t=' + cModo); } function CalculaFrete() { var curDateTime = new Date() var curHour = curDateTime.getHours() var curMin = curDateTime.getMinutes() var curSec = curDateTime.getSeconds() cCEP1 = document.getElementById("txtCEP1").value; cCEP2 = document.getElementById("txtCEP2").value; if (cCEP1 == null || cCEP1 == "") { alert("Por favor informe o cep"); document.getElementById("txtCEP1").focus(); return false; } if (cCEP2 == null || cCEP2 == "") { alert("Por favor informe o cep"); document.getElementById("txtCEP2").focus(); return false; } cParametros = cCEP1 + cCEP2 + "&t=" + curHour + curMin + curSec; enviaPagina('CalculaFrete.asp', 'POST', 'true', 'SpanFrete', "cep=" + cParametros ) } function CalculaFrete2(cCep) { var curDateTime = new Date() var curHour = curDateTime.getHours() var curMin = curDateTime.getMinutes() var curSec = curDateTime.getSeconds() cParametros = cCep + "&t=" + curHour + curMin + curSec; enviaPagina('CalculaFrete.asp', 'POST', 'true', 'SpanFrete', "cep=" + cParametros ) } function MostaFormaEntrega(cCep) { var oXmlHttp=false; try { oXmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { oXmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { try { oXmlHttp = new XMLHttpRequest(); } catch(e) { alert("Erro: Este browser não tem recursos para uso do Ajax!"); } } } var curDateTime = new Date() var curHour = curDateTime.getHours() var curMin = curDateTime.getMinutes() var curSec = curDateTime.getSeconds() var url = "ExibeFormaEntrega.asp"; var metodo = "POST"; var modo = "true"; var tagRetorno = "SpanFormaEntrega"; cParametros = "?cep="+ cCep + "&t=" + curHour + curMin + curSec; document.getElementById(tagRetorno).innerHTML='




'; if (metodo == "GET") { url = url+"?"+cParametros+"&rnd="+ Math.random(); } else { url = url+"?rnd="+ Math.random(); } if(metodo == "GET") { oXmlHttp.open("GET", url, modo); } else { oXmlHttp.open("POST", url, modo); oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1"); oXmlHttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate"); oXmlHttp.setRequestHeader("Cache-Control", "post-check=0, pre-check=0"); oXmlHttp.setRequestHeader("Pragma", "no-cache"); } oXmlHttp.onreadystatechange = function() { if(oXmlHttp.readyState == 4) { if (oXmlHttp.Status == 200 || oXmlHttp.Status == null ) { retorno=oXmlHttp.responseText document.getElementById(tagRetorno).innerHTML=retorno } else if (oXmlHttp.Status == 404) { document.getElementById(tagRetorno).innerHTML = "
Atenção! - Página não econtrada
"; } else if(oXmlHttp.Status == 1223) { document.getElementById(tagRetorno).innerHTML = "
Atenção! - a página solicitada não retornou nenhum conteudo
"; } else { //retorno=oXmlHttp.responseText //document.getElementById(tagRetorno).innerHTML=retorno document.getElementById(tagRetorno).innerHTML = "
Ocorreu exceção " + oXmlHttp.responseText + "
" } } } if(metodo == "GET") { oXmlHttp.send(null); } else { oXmlHttp.send(cParametros); } } function GeraNumero(valor){ document.getElementById('txtNumeroCartao').value += valor; } function EscreveNumero(valor){ document.getElementById('txtNumeroCartao').value += valor; } function VoltaCampo(cCampo) { if (cCampo.value.length > 0) { cCampo.value = cCampo.value.substring(0,cCampo.value.length - 1) } else { cCampo.value = ""; } } function tabCartao(nTotal,nItem){ for(x=1;x<=nTotal;x++){ panel=eval('document.getElementById("tabCartao' + x + '").style;'); tab = eval('document.getElementById("tdBandeira' + x + '").style;'); if(x==nItem){ panel.display=''; tab.classname=''; tab.borderColor='#808080'; } else { panel.display='none'; tab.borderColor='#EEEEEE'; tab.classname='caixa_produto'; } } } function ExibeCodigoSeg(cTipo) { abre_janela('exibe_codigo_seguranca.asp?img=' + cTipo, 445, 200, 'imagem_seguranca'); } function EscolheFormaPagto(nPedido) { abre_janela('escolhe_forma_pagto.asp?nCod=' + nPedido, 500, 540, 'forma_pagto'); } function conta(campo){ cNumero = document.getElementById(campo).value.length; if(cNumero >= 16) { document.getElementById("teclado").style.visibility = 'hidden'; } else { document.getElementById("teclado").style.visibility = 'visible'; } }