function openInform(prd,prd_attr) {
    openWindow('/index?page=product/product_inform&prd=' + prd + ((prd_attr)?('&prd_attr=' + prd_attr):'') + '&light=1&only_page=1', 'inform'+prd, 695, 220);
}

function URLDecode(str){
    if(str!=null && str!='undefined'){
        for(i=0;i<str.length;i++){
            str = unescape(str);
        }
        return decodeURIComponent(str.replace(/\+/g,' '));
    }else{
        return '';
    }
}
function stripHTML(str){
    if(str!=null && str!='undefined'){
        return str.replace(/(<([^>]+)>)/ig,"");
    }else{
        return '';
    }
}
var querystring={
    param : new Array(),
    init : function(){
        var params = window.location.search.replace('?','').split('&');
        for(var i=0; i<params.length; i++){
            if(params[i].indexOf('='!=-1)){
                var arr=params[i].split('=');
                this.param[arr[0].toLowerCase()]=URLDecode(arr[1]);
            }
        }
    },
    get : function(name){
        if(name){
            if(querystring.param[name.toLowerCase()]){
                return querystring.param[name.toLowerCase()];
            }else{
                return '';
            }
        }else{
            return window.location.search.replace('?','');
        }
    }
}
querystring.init();
var request=querystring.get;
function PopupCentro(pagina,nome,w,h,scroll){
    LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
    settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',toolbar=no, menubar=no, resizable=no, status=no';
    window.open(pagina,nome,settings);
}
function toggle(i)
{
    if (i.style.display=="none")
        {
            i.style.display="block";
        }
    else
        {
            i.style.display="none";
        }
}  
function addEvent(ev,obj,fcn){
    if(typeof(obj)=="object"){
        if(window.addEventListener){
            obj.addEventListener(ev,fcn,true);
        }else if(window.attachEvent){
            obj.attachEvent("on"+ev,fcn);
        }
    }
}
// INICIO - FUNÇÃO PARA VERIFICAR ANTI-POPUP
function verificarAntiPopup()
{
    tempo = 2 //tempo de espera em segundos
    delay = tempo*100 // não alterar
    count = 0 // não alterar
    antipopup = true
    window.open('antipopup_verificar.asp','teste','width=1 ,height=1')
    window.focus()
    Timer()
}
function Timer()
{
    if (count >= delay && antipopup == true)
        alert("        Para melhor navegação neste site\npedimos que você desabilite o seu Anti-Popup!!")
    else if (!antipopup) {}
    else if (count < delay)
    {
        count++
        setTimeout("Timer()", 1)
    }
}
function PopupOK()
{
    window.opener.antipopup = false
    setTimeout("window.close()", 100)
}
// FIM - FUNÇÃO PARA VERIFICAR ANTI-POPUP
function abrijanela(endereco,nomedajanela,EzTemp) { window.open(endereco,nomedajanela,EzTemp)}
function indicar(id) {
    NomePagina = "popup_indicar_produto.asp?produtoid=" + id;
    PopupCentro(NomePagina,"IndicarAmigo",300,100,"no");
    //window.open('indicarprodutos.asp?produtoid=' + id,'IndicarAmigo','width=300,height=220,toolbar=no,scrollbars=no,top=200,left=250');
}
function duvida(id) {
    NomePagina = 'popup_duvida.asp?produtoid=' + id;
    PopupCentro(NomePagina,"PerguntarALoja",300,340,"no");
    //window.open('popup_duvida.asp?produtoid=' + id,'PerguntarALoja','width=300,height=335,toolbar=no,scrollbars=no,top=200,left=250');
}
function deletar_item(num) {
    window.document.location.href='carrinho_remover.asp?SessionItemID='+num
}
function limita_textarea(campo){
    var tamanho = document.form[campo].value.length;
    var tex=document.form[campo].value;
    if (tamanho>=1539) {
        document.form[campo].value=tex.substring(0,1539); 
    }
    return true;
}
function contacampo(campo, tamtxt) {
    document.form[tamtxt].value =  1540-document.form[campo].value.length;
}
function Apaga(){
    if (document.form.elements.length != 0)
        for (i = 0; i < document.form.elements.length; i++)
        {
            if( document.form[i].type != "hidden" )
                document.form[i].value="";
        }
}
function mandaurl(url) {
    window.location = url;
}
var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1); 
function printPage()
{
  if (pr) // NS4, IE5
    window.print()
  else if (da && !mac) // IE4 (Windows)
    vbPrintPage()
  else // other browsers
    alert("Desculpe seu browser não suporta esta função. Por favor utilize a barra de trabalho para imprimir a página.");
  return false;
}
if (da && !pr && !mac) with (document) {
  writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
  writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
  writeln('Sub window_onunload');
  writeln('  On Error Resume Next');
  writeln('  Set WB = nothing');
  writeln('End Sub');
  writeln('Sub vbPrintPage');
  writeln('  OLECMDID_PRINT = 6');
  writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
  writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
  writeln('  On Error Resume Next');
  writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
  writeln('End Sub');
  writeln('<' + '/SCRIPT>');
}
function checkMail(mail){
    var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
    if(er.test(mail)){ 
        return true;
    }else{
        alert("E-mail inválido")
        return false;
    }
}
// INICIO - FUNÇÕES DE FORMATAÇÃO DE DADOS
function FormataDado(campo,tammax,pos,teclapres){
    var tecla = teclapres.keyCode;
    vr = document.form[campo].value;
    vr = vr.replace( "-", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( "/", "" );
    tam = vr.length ;
    if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }

    if (tecla == 8 ){ tam = tam - 1 ; }
            
    if ( tecla == 8 || tecla == 88 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
        if ( tam <= 2 ){
            document.form[campo].value = vr ;}
        if ( tam > pos && tam <= tammax ){
            document.form[campo].value = vr.substr( 0, tam - pos ) + '-' + vr.substr( tam - pos, tam );}
    }
    //alert("campo: " + document.form[campo+1].name);
    if ( !teclapres.shiftKey && tecla == 9 && document.form[campo+1].name == "senhaConta" && document.applets['tclJava'] ){
        //alert("aki 1");
            document.applets['tclJava'].setFocus();
    }
}
function FormataValor(campo,tammax,teclapres) {
    var tecla = teclapres.keyCode;
    vr = document.form[campo].value;
    vr = vr.replace( "/", "" );
    vr = vr.replace( "/", "" );
    vr = vr.replace( ",", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    tam = vr.length;

    if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }

    if (tecla == 8 ){   tam = tam - 1 ; }
        
    if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
        if ( tam <= 2 ){ 
            document.form[campo].value = vr ; }
        if ( (tam > 2) && (tam <= 5) ){
            document.form[campo].value = vr.substr( 0, tam - 2 ) + ',' + vr.substr( tam - 2, tam ) ; }
        if ( (tam >= 6) && (tam <= 8) ){
            document.form[campo].value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
        if ( (tam >= 9) && (tam <= 11) ){
            document.form[campo].value = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
        if ( (tam >= 12) && (tam <= 14) ){
            document.form[campo].value = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
        if ( (tam >= 15) && (tam <= 17) ){
            document.form[campo].value = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ;}
    }
        
    for (var ct = 0; ct < document.form.elements.length; ct++) {
        if (document.form.elements[ct].name == document.form.elements[campo].name) {
            if ( !teclapres.shiftKey && tecla == 9 && document.form.elements[ct+1] && document.form.elements[ct+1].name == "senhaConta" && document.applets['tclJava'] ){
                document.applets['tclJava'].setFocus();
            }   
        }
    }
}
function SaltaCampo (campo,prox,tammax,teclapres){
    var tecla = teclapres.keyCode;
    vr = document.form[campo].value;
    if( tecla == 109 || tecla == 188 || tecla == 110 || tecla == 111 || tecla == 223 || tecla == 108 ){
        document.form[campo].value = vr.substr( 0, vr.length - 1 ); }
    else{
        vr = vr.replace( "-", "" );
        vr = vr.replace( "/", "" );
        vr = vr.replace( "/", "" );
        vr = vr.replace( ",", "" );
        vr = vr.replace( ".", "" );
        vr = vr.replace( ".", "" );
        vr = vr.replace( ".", "" );
        vr = vr.replace( ".", "" );
        tam = vr.length;    
        
        if (tecla != 0 && tecla != 9 && tecla != 16 && tecla != 144 ){
        
            if ( tam == tammax ){
                if ( prox == "senhaConta" || (document.form.elements[prox] && document.form.elements[prox].name == "senhaConta"))
                {
                    if ( document.applets['tclJava'] )
                        document.applets['tclJava'].setFocus();
                    else if ( document.form.senhaConta )
                        document.form.senhaConta.focus();
                }
                else if ( document.form[prox] )
                    document.form[prox].focus();
            }
        }
    }
}
function FormataData(campo,teclapres) {
    var tecla = teclapres.keyCode;
    vr = document.form[campo].value;
    vr = vr.replace( ".", "" );
    vr = vr.replace( "/", "" );
    vr = vr.replace( "/", "" );
    tam = vr.length + 1;

    if ( tecla != 9 && tecla != 8 ){
        if ( tam > 2 && tam < 5 )
            document.form[campo].value = vr.substr( 0, tam - 2  ) + '/' + vr.substr( tam - 2, tam );
        if ( tam >= 5 && tam <= 10 )
            document.form[campo].value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, 2 ) + '/' + vr.substr( 4, 4 ); 
    }
/*  
    for (var ct = 0; ct < document.form.elements.length; ct++) {
        if (document.form.elements[ct].name == document.form.elements[campo].name) {
            if ( !teclapres.shiftKey && tecla == 9 && document.form[ct+1].name == "senhaConta" && document.applets['tclJava'] ){
                document.applets['tclJava'].setFocus();
            }   
        }
    }
*/
}
function FormataMesAno(Campo,teclapres) {
    var tecla = teclapres.keyCode;
    vr = document.form[Campo].value;
    vr = vr.replace( ".", "" );
    vr = vr.replace( "/", "" );
    vr = vr.replace( "/", "" );
    tam = vr.length + 1;

    if ( tecla != 9 && tecla != 8 ){
        if ( tam > 2 && tam < 7 )
            document.form[Campo].value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, tam ); }
}
function FormataPercentual(campo,tammax,teclapres) {
    var tecla = teclapres.keyCode;
    vr = document.form[campo].value;
    vr = vr.replace( "/", "" );
    vr = vr.replace( "/", "" );
    vr = vr.replace( ",", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    tam = vr.length;

    if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }

    if (tecla == 8 ){   tam = tam - 1 ; }
        
    if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
        if ( tam <= 3 ){ 
            document.form[campo].value = vr ; }
        if ( (tam > 3) && (tam <= 6) ){
            document.form[campo].value = vr.substr( 0, tam - 3 ) + ',' + vr.substr( tam - 3, tam ) ; }
    }       
    
}
function FormataCpf(campo,tammax,teclapres) {
    var tecla = teclapres.keyCode;
    vr = document.form[campo].value;
    vr = vr.replace( "/", "" );
    vr = vr.replace( "/", "" );
    vr = vr.replace( ",", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( "-", "" );
    vr = vr.replace( "-", "" );
    vr = vr.replace( "-", "" );
    vr = vr.replace( "-", "" );
    vr = vr.replace( "-", "" );
    tam = vr.length;

    if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }

    if (tecla == 8 ){   tam = tam - 1 ; }
        
    if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
        if ( tam <= 2 ){ 
            document.form[campo].value = vr ; }
        if ( (tam > 2) && (tam <= 5) ){
            document.form[campo].value = vr.substr( 0, tam - 2 ) + '-' + vr.substr( tam - 2, tam ) ; }
        if ( (tam >= 6) && (tam <= 8) ){
            document.form[campo].value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ) ; }
        if ( (tam >= 9) && (tam <= 11) ){
            document.form[campo].value = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ) ; }
        if ( (tam >= 12) && (tam <= 14) ){
            document.form[campo].value = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ) ; }
        if ( (tam >= 15) && (tam <= 17) ){
            document.form[campo].value = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ) ;}
    }       
}
function FormataCartaoCredito(campo, teclapres) {
    var tammax = 16;
    var tecla = teclapres.keyCode;
    vr = document.form[campo].value;

    if ( tecla == 8 || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) )
    {
        vr = vr.replace( "/", "" );
        vr = vr.replace( "/", "" );
        vr = vr.replace( ",", "" );
        vr = vr.replace( ".", "" );
        vr = vr.replace( ".", "" );
        vr = vr.replace( ".", "" );
        vr = vr.replace( ".", "" );
        vr = vr.replace( "-", "" );
        vr = vr.replace( "-", "" );
        vr = vr.replace( "-", "" );
        vr = vr.replace( "-", "" );
        vr = vr.replace( "-", "" );
        tam = vr.length;

        if (tam < tammax && tecla != 8)
           {tam = vr.length + 1 ; }

        if (tecla == 8 ) {tam = tam - 1 ; }

        if ( tam < 5 )
           { document.form[campo].value = vr ; }
        if ( ( tam >  4 ) && ( tam < 9 ) )
           { document.form[campo].value = vr.substr( 0, 4 ) + '.' + vr.substr( 4, tam-4 ) ; }
        if ( ( tam >  8 ) && ( tam < 13 ) )
           { document.form[campo].value = vr.substr( 0, 4 ) + '.' + vr.substr( 4, 4 ) + '.' + vr.substr( 8, tam-4 ) ; }
        if ( tam > 12 )
           { document.form[campo].value = vr.substr( 0, 4 ) + '.' + vr.substr( 4, 4 ) + '.' + vr.substr( 8, 4 ) + '.' + vr.substr( 12, tam-4 ); }
    }   
}
function FormataCgc(campo,tammax,teclapres) {
    var tecla = teclapres.keyCode;
    vr = document.form[campo].value;
    vr = vr.replace( "/", "" );
    vr = vr.replace( "/", "" );
    vr = vr.replace( "/", "" );
    vr = vr.replace( ",", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( "-", "" );
    vr = vr.replace( "-", "" );
    vr = vr.replace( "-", "" );
    vr = vr.replace( "-", "" );
    vr = vr.replace( "-", "" );
    tam = vr.length;

    if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }

    if (tecla == 8 ){   tam = tam - 1 ; }
        
    if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
        if ( tam <= 2 ){ 
            document.form[campo].value = vr ; }
        if ( (tam > 2) && (tam <= 6) ){
            document.form[campo].value = vr.substr( 0, tam - 2 ) + '-' + vr.substr( tam - 2, tam ) ; }
        if ( (tam >= 7) && (tam <= 9) ){
            document.form[campo].value = vr.substr( 0, tam - 6 ) + '/' + vr.substr( tam - 6, 4 ) + '-' + vr.substr( tam - 2, tam ) ; }
        if ( (tam >= 10) && (tam <= 12) ){
            document.form[campo].value = vr.substr( 0, tam - 9 ) + '.' + vr.substr( tam - 9, 3 ) + '/' + vr.substr( tam - 6, 4 ) + '-' + vr.substr( tam - 2, tam ) ; }
        if ( (tam >= 13) && (tam <= 14) ){
            document.form[campo].value = vr.substr( 0, tam - 12 ) + '.' + vr.substr( tam - 12, 3 ) + '.' + vr.substr( tam - 9, 3 ) + '/' + vr.substr( tam - 6, 4 ) + '-' + vr.substr( tam - 2, tam ) ; }
        if ( (tam >= 15) && (tam <= 17) ){
            document.form[campo].value = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ) ;}
    }       
}
function FormataTelefone(campo,tammax,teclapres) {
    var tecla = teclapres.keyCode;
    vr = document.form[campo].value;
    vr = vr.replace( "/", "" );
    vr = vr.replace( "/", "" );
    vr = vr.replace( ",", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( ".", "" );
    vr = vr.replace( "-", "" );
    vr = vr.replace( "-", "" );
    vr = vr.replace( "-", "" );
    vr = vr.replace( "-", "" );
    vr = vr.replace( "-", "" );
    tam = vr.length;

    if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }

    if (tecla == 8 ){   tam = tam - 1 ; }
        
    if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
        if ( tam <= 2 ){ 
            document.form[campo].value = vr ; }
        if ( (tam > 4) ){
            document.form[campo].value = vr.substr( 0, tam - 4 ) + '-' + vr.substr( tam - 4, tam ) ; }
    }       
}

// FIM  - FUNCÃO DE FORMAÇÃO DE DADOS
var submeteuFormulario = 0;
function controleDoubleClick() 
{
    if(submeteuFormulario=="1") 
    {
        alert("O botão 'OK' ou 'Confirma' foi acionado mais de uma vez enquanto a transação estava em andamento. Aguarde... ");
        return false;
    }
    submeteuFormulario = "1";
    return true;
}
//-->
// RECONHECE O BROWSER
var ns4 = (document.layers) ? true : false
var ie4 = (document.all) ? true : false
// FILTRA AS TECLAS PRESSIONADAS
function filtra(obj, padrao) {
    var ev      = (e) ? e : event; 
    var tk      = (ie4) ? ev.keyCode : ev.which;
    var letra   = String.fromCharCode(tk);
    
    for (x = 0; x < padrao.length; x++)
        if (padrao.slice(x, x + 1) == letra) return true;
    return true;
}
// FUNCOES PARA CONTROLE DE AVANCO EM CAMPOS DE TEXTO
function semTab() {
    checatab = false;
}
function comTab() {
    checatab = true;
} 
checatab = true;
function pula(origem, tamanho, destino) {
    if ((origem.value.length == tamanho) && checatab)
        destino.focus();
}
//FUNÇÃO PARA MODIFICAR O STATUS DO LAYER: VISIBLE/HIDDEN
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
function isMailValid(src) {
    var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
    var regex = new RegExp(emailReg);
    return regex.test(src);
}
function jumpNextField(pLenght, pSrc, pDst) {
    var src = document.getElementById(pSrc);
    var dst = document.getElementById(pDst);

    if ( src.value.length >= pLenght )
    {
        dst.focus();
    }
}
// AJAX
http_request    = false;
function $ez_ajax(url,fcn){
    if(window.XMLHttpRequest){ // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        /*if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
        }*/
    }else if(window.ActiveXObject) { // IE
        try{
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
            try{
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            }catch(e){}
        }
    }

    if(!http_request){
        alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }

    if(fcn){
        http_request.onreadystatechange = fcn;
    }

    http_request.open('GET', url, true);
    
    http_request.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
    http_request.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
    http_request.setRequestHeader("Pragma", "no-cache");
    
    http_request.send(null);
}                                   
// FUNÇÃO DO CARRINHO
function getTarifa(){
    if(http_request.readyState == 4){
        if(http_request.status == 200){
            txt = http_request.responseText;
            xml = http_request.responseXML;
            if(txt=="Sessão Expirada!"){
                location.reload();
            }else{
                document.getElementById("TOTAL").innerHTML = txt;
                strValidaEntrega = true;
            }
        }
    }
}
function DefinirTarifa(get){
    $ez_ajax("Carrinho_Definir_Tarifa.asp?"+get,getTarifa);
}
function getSessionID(){
    if(document.getElementById("SessionID")){
        document.getElementById("SessionID").value = "32307";
        return true;
    }else{
        return false;
    }
}
//================================
// FUNÇÕES DO PRODUTO
function DefinirFps(post,varHtml){
    if(contaFps==0){
        document.getElementById("loadingFps").style.display = "block";
        //$ez_ajax('Produtos_FP.asp?produtoid='+produtoid+'&varid='+varid+'&subvarid='+subvarid,getFps);
        if(varHtml){
            $ez_ajax('Produtos_FP.asp?post='+post,function(){getFps(varHtml)});
        }else{
            $ez_ajax('Produtos_FP.asp?post='+post,getFps);
        }
        contaFps++;
    }
}
function getFps(varHtml){
    if(http_request.readyState == 4){
        if(http_request.status == 200){
            var Html = http_request.responseText;
            if(Html!=""){
                Count = Count+1;
                document.getElementById("global_tbl_pagamentos").innerHTML = Html;
                document.getElementById("loadingFps").style.display = "none";
                pgtoResize = true;
                if(Count==1){
                    FPS = Html;
                }else if(document.getElementById("inputVarid").value.toString()!='0' && document.getElementById("inputSubvarid").value.toString()=='0'){
                    FPSVar = Html;
                }
                if(varHtml){
                    varHtml.html = Html;
                }
            }
        }
    }
}
function showFps(i){
    var div = document.getElementById("pagamentos");
    if(div){
        if(i==1){
            if(div.style.display=="none"){
                div.style.display="block";
                /*if(document.getElementById("swf_video")){
                    document.getElementById("swf_video").style.visibility = "hidden";
                }*/
                if(document.getElementById("pnlPagtos")){
                    if(document.getElementById("pnlPagtos").offsetHeight < 400 && pgtoResize){
                        if(navigator.product != 'Gecko'){
                            document.getElementById("global_tbl_pagamentos").style.height = document.getElementById("pnlPagtos").offsetHeight + "px";
                        }else{
                            document.getElementById("global_tbl_pagamentos").style.height = (document.getElementById("pnlPagtos").offsetHeight+6) + "px";
                        }
                        pgtoResize = false;
                    }
                }
            }else{
                div.style.display="none";
                /*if(document.getElementById("swf_video")){
                    document.getElementById("swf_video").style.visibility = "visible";
                }*/
            }
        }else{
            if(pgtoMouseDown==0 && window.bgOpened == false){
                div.style.display="none";
                /*if(document.getElementById("swf_video")){
                    document.getElementById("swf_video").style.visibility = "visible";
                }*/
            }
        }
    }
}
function GerarFotos(Fotos){
    var div      =  document.createElement("div");
    var strHTML  =  '<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" onMouseDown="if(fMouseDown){fechaFotos()}" onContextMenu="return false;" onSelectStart="return false;" style="-moz-user-select: none;">'+
                    '   <tr>'+
                    '       <td height="100%" align="center" valign="middle">'+
                    '           <table bgcolor="#FFFFFF" width="700" height="500" border="0" cellspacing="0" cellpadding="0" style="width:700px; height:500px; background-color:#FFFFFF; border:1px solid #E6E6E6;" onMouseOver="fMouseDown = false;" onMouseOut="fMouseDown = true;">'+
                    '               <tr>'+
                    '                   <td valign="top" height="22" style="padding:1px 1px 0px 1px;">'+
                    '                       <table width="100%" border="0" cellspacing="0" cellpadding="0" style="height:22px; border-bottom:1px solid #E6E6E6; background-image:url(FILES/_IMG/design/bg_fechar.gif); background-repeat:repeat-x;">'+
                    '                           <tr>'+
                    '                               <td height="22" valign="middle" style="padding-left:4px; font-size:10px"><strong>ZOOM</strong></td>'+
                    '                               <td align="right" valign="middle"><img src="FILES/_IMG/design/bt_fechar.gif" alt="" align="right" onClick="fechaFotos()" style="cursor:pointer;"></td>'+
                    '                           <tr>'+
                    '                       </table></td>'+
                    '               </tr>'+
                    '               <tr>'+
                    '                   <td align="center" valign="middle" style="padding-right:2px;">'+
                    '                       <div style="position:relative; width:100%; height:100%;">'+
                    '                           <div id="overflow" style="position:absolute; top:0px; left:0px; overflow:auto; width:100%; height:100%;" align="center">'+
                    '                               <table height="100%" border="0" cellspacing="0" cellpadding="0" align="center">'+
                    '                                   <tr>'+
                    '                                       <td height="100%" align="center" valign="middle" style="padding:5px;">'+Fotos+'</td>'+
                    '                                   </tr>'+
                    '                               </table>'+
                    '                           </div>'+
                    '                       </div>'+
                    '                   </td>'+
                    '               </tr>'+
                    '               <tr>'+
                    '                   <td align="center" valign="middle" height="22" style="border-top:1px solid #E6E6E6; background-image:url(FILES/_IMG/design/bg_fechar.gif); background-repeat:repeat-x; text-transform:uppercase; font-size:10px; padding:2px;"><strong>'+document.getElementById('NomeProduto').innerHTML+'</strong></td>'+
                    '               </tr>'+
                    '           </table>'+
                    '       </td>'+
                    '   </tr>'+
                    '</table>';
    div.id              = "globalfotos";
    div.style.position  = "absolute";
    div.style.top       = "0px";
    div.style.left      = "0px";
    div.style.width     = "100%";
    div.style.height    = "100%";
    div.style.display   = "none";
    div.style.zIndex    = "20";
    div.innerHTML       = strHTML;
    document.body.appendChild(div);
}
function GerarTA(Termo){
    var div      =  document.createElement("div");
    var strHTML  =  '<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" onMouseDown="if(fMouseDown){fechaTA()}" onContextMenu="return false;" onSelectStart="return false;" style="-moz-user-select: none;">'+
                    '   <tr>'+
                    '       <td height="100%" align="center" valign="middle">'+
                    '           <table bgcolor="#FFFFFF" width="600" height="350" border="0" cellspacing="0" cellpadding="0" style="width:600px; height:350px; background-color:#FFFFFF; border:1px solid #E6E6E6;" onMouseOver="fMouseDown = false;" onMouseOut="fMouseDown = true;">'+
                    '               <tr>'+
                    '                   <td valign="top" height="22" style="padding:1px 1px 0px 1px;">'+
                    '                       <table width="100%" border="0" cellspacing="0" cellpadding="0" style="height:22px; border-bottom:1px solid #E6E6E6; background-image:url(FILES/_IMG/design/bg_fechar.gif); background-repeat:repeat-x;">'+
                    '                           <tr>'+
                    '                               <td height="22" valign="middle" style="padding-left:4px; font-size:10px"><strong>TERMO DE ACEITA&Ccedil;&Atilde;O</strong></td>'+
                    '                               <td align="right" valign="middle"><img src="FILES/_IMG/design/bt_fechar.gif" alt="" align="right" onClick="fechaTA()" style="cursor:pointer;"></td>'+
                    '                           <tr>'+
                    '                       </table></td>'+
                    '               </tr>'+
                    '               <tr>'+
                    '                   <td align="center" valign="middle" style="padding-right:2px;">'+
                    '                       <div style="position:relative; width:100%; height:100%;">'+
                    '                           <div id="overflow" style="position:absolute; top:0px; left:0px; overflow:auto; width:100%; height:100%;" align="center">'+
                    '                               <table height="100%" border="0" cellspacing="0" cellpadding="0" align="center">'+
                    '                                   <tr>'+
                    '                                       <td height="100%" align="justify" valign="middle" style="padding:5px;">'+Termo+'</td>'+
                    '                                   </tr>'+
                    '                               </table>'+
                    '                           </div>'+
                    '                       </div>'+
                    '                   </td>'+
                    '               </tr>'+
                    '               <tr>'+
                    '                   <td align="center" valign="middle" height="22" style="border-top:1px solid #E6E6E6; background-image:url(FILES/_IMG/design/bg_fechar.gif); padding:2px;">'+
                    '                       <table width="100%" border="0" cellspacing="0" cellpadding="0">'+
                    '                           <tr>'+
                    '                               <td width="1" style="padding-right:5px; padding-left:1px;" valign="middle"><input type="checkbox" id="checkTA" alt="Clique para comprar este ingresso" onClick="validaTA()"></td>'+
                    '                               <td class="a8 preco b" width="1" height="30" valign="middle" style="padding-left:2px;"><nobr>Li e aceito o termo de aceita&ccedil;&atilde;o</nobr></td>'+
                    '                               <td height="30" valign="middle" style="padding-left:8px;"><input type="image" id="okTA" src="FILES/_IMG/design/bt_confirmar.gif" align="Adicionar ao Carrinho" onClick="document.getElementById(\'Pedido\').submit()" style="display:none; cursor:pointer;"></td>'+
                    '                           </tr>'+
                    '                       </table>'+
                    '                   </td>'+
                    '               </tr>'+
                    '           </table>'+
                    '       </td>'+
                    '   </tr>'+
                    '</table>';
    div.id              = "globalTA";
    div.style.position  = "absolute";
    div.style.top       = "0px";
    div.style.left      = "0px";
    div.style.width     = "100%";
    div.style.height    = "100%";
    div.style.display   = "none";
    div.style.zIndex    = "20";
    div.innerHTML       = strHTML;
    document.body.appendChild(div);
}
function validaTA(){
    ok = document.getElementById("okTA");
    check = document.getElementById("checkTA").checked;
    if(strValidaTA == false || check == true){
        ok.style.display = "block";
        ok.disabled = false;
        strValidaTA = true;
    }else{
        ok.style.display = "none";
        ok.disabled = true;                                             
        strValidaTA = false;
    }
}
if(request('produtoid')!=''){
    fMouseDown      = false;
    contaFps        = 0;
    FPS             = "";
    FPSVar          = "";
    Count           = 0;
    pgtoMouseDown   = 0;
    pgtoResize      = true;
    strValidaTA     = false;
    strVarIdTA      = "";
    addEvent("mousedown",document,showFps);
}
function validapesquisa(){
    var strProduto = document.pesquisa.produto.value;

    if(strProduto == "" || strProduto == "Palavra-Chave"){
        alert("Você deve digitar uma palavra-chave!");
        document.pesquisa.produto.value="";
        document.pesquisa.produto.focus();
        return false;
    }
}
function OpenThawte(){
    thewindow = window.open('https://www.thawte.com/cgi/server/certdetails.exe?code=BREZCO8-1','Thawte','width=495,height=495,toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=yes,directories=no,status=yes');
    thewindow.focus();
}
function hidestatus(){
    window.status = 'SmartDATA Informática';
    return true;
}
/*var MSG = stripHTML(request('msg')).replace(/\\n/g,'\n');
if (MSG != '') {
   addEvent("load",window,function(){alert(MSG)});
}*/
addEvent("load",window,hidestatus);
/*addEvent("load",window,function(){w3Opacity.set('bg',70)});*/
addEvent("mouseover",document,hidestatus);
addEvent("mouseout",document,hidestatus);
addEvent("mousedown",document,hidestatus);
addEvent("click",document,hidestatus);
function openAO(){
    if(document.getElementById('ifrAO')){
/*        document.getElementById('ifrAO').src = 'ChatOnline.asp?u=http://mkt.smartdata.com.br/chat/';*/
    }
}
addEvent("load",window,openAO);
/*document.write(unescape("%3Cscript src='FILES/_JS/w3opacity-1.0.js' type='text/javascript'%3E%3C/script%3E"));*/
document.write(unescape("%3Cscript src='/FILES/_JS/swfobject.js' type='text/javascript'%3E%3C/script%3E"));

<!-- INI 1 -->
/* Transforma dados no formato de moeda */
function formatCurrency(num) {
    num = replaceChar(num);
    num = num.toString().replace(/\$|\,/g,'');

    if(isNaN(num)) { num = "0"; }

    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num*100+0.50000000001);
    cents = num%100;
    num = Math.floor(num/100).toString();

    if(cents<10)
        cents = "0" + cents;

    return (((sign)?'':'-') + num + '.' + cents);
}
<!-- FIM -->

<!-- INI 1 -->
function replaceChar(entry) {
    out = ","; /* replace this */
    add = "."; /* with this */
    temp = "" + entry; /* temporary holder */

    while (temp.indexOf(out)>-1) {
        pos= temp.indexOf(out);
        temp = "" + (temp.substring(0, pos) + add +
        temp.substring((pos + out.length), temp.length));
    }
    return temp;
}
<!-- FIM -->

