j1n = new Image();
j1n.src = "buy.gif";

var ultimo_tab;
//ultimo_tab = "tab_a1";
ultimo_tab = "teodora";

var sumidos = 0;

var nacho1 = 0;
var mytabsA = new Array();
mytabsA[1] = "0";
mytabsA[2] = "0";
mytabsA[3] = "0";
mytabsA[4] = "0";
mytabsA[5] = "0";
mytabsA[6] = "0";
mytabsA[7] = "0";
mytabsA[8] = "0";

var mytabsB = new Array();
mytabsB[1] = "0";
mytabsB[2] = "0";
mytabsB[3] = "0";
mytabsB[4] = "0";
mytabsB[5] = "0";
mytabsB[6] = "0";
mytabsB[7] = "0";
mytabsB[8] = "0";

taba0 = new Image();
tabb0 = new Image();
tabb1 = new Image();
tabb2 = new Image();
tabb3 = new Image();
tabb4 = new Image();
tabb5 = new Image();
tabb6 = new Image();
tabb7 = new Image();
tabb8 = new Image();

taba1 = new Image();
taba2 = new Image();
taba3 = new Image();
taba4 = new Image();
taba5 = new Image();
taba6 = new Image();
taba7 = new Image();
taba8 = new Image();

var mytabsC = new Array();
mytabsC[3] = "0";
mytabsC[32] = "0";

tabc3 = new Image();
tabc32 = new Image();
tabc3.src = "/images/acessorios/aba_final_03.jpg";
tabc32.src = "/images/acessorios/aba_final2_03.jpg";

taba0.src = "/images/acessorios/taba0.jpg";
tabb0.src = "/images/acessorios/tabb0.jpg";
tabb1.src = "/images/acessorios/tabb1.jpg";
tabb2.src = "/images/acessorios/tabb2.jpg";
tabb3.src = "/images/acessorios/tabb3.jpg";
tabb4.src = "/images/acessorios/tabb4.jpg";
tabb5.src = "/images/acessorios/tabb5.jpg";
tabb6.src = "/images/acessorios/tabb6.jpg";
tabb7.src = "/images/acessorios/tabb7.jpg";
tabb8.src = "/images/acessorios/tabb8.jpg";

taba1.src = "/images/acessorios/taba1.jpg";
taba2.src = "/images/acessorios/taba2.jpg";
taba3.src = "/images/acessorios/taba3.jpg";
taba4.src = "/images/acessorios/taba4.jpg";
taba5.src = "/images/acessorios/taba5.jpg";
taba6.src = "/images/acessorios/taba6.jpg";
taba7.src = "/images/acessorios/taba7.jpg";
taba8.src = "/images/acessorios/taba8.jpg";

var ultimo;

function troca_fundo(dia) {
    ultimo.bgColor = '#FFFFFF';
    document.getElementById("cell" + dia).bgColor = '#FFDFA5';  
    ultimo=document.getElementById("cell" + dia);
  }


  function troca_div(flornum, cid, mes, ano) {
      if (document.getElementById("cepnew_campo").value.length < 8) {
          alert("Por favor defina o CEP de entrega!");
          document.getElementById("cepnew_campo").focus();
          return false;
      }


    document.getElementById('ddm2011_0').style.display = "none";
    document.getElementById('ddm2011_1').style.display = "none";
    document.getElementById('ddm2011_2').style.display = "none";
    document.getElementById('ddm2011_3').style.display = "none";



    document.getElementById('calendario').innerHTML = "<center><BR><BR><IMG SRC='/images/gray75_polling.gif' width=75 height=75 alt=''></center>"
    cep = document.fol.cepnew_campo.value;
    document.getElementById('cepnew').innerHTML = ""
    showPage22('calendar_detalhe.asp?ano=' + ano + '&mes=' + mes + '&cidxx=' + cid + '&flornum=' + flornum + '&cep=' + cep, 'calendario');
    //newImage = "url(/images/same031.jpg)";
    //document.getElementById('same03').style.backgroundImage = newImage;
}

function troca_div22(flornum) {
    cep = document.fol.cepnew_campo.value;
    showPage22('data.asp?flornum=' + flornum  + '&cep=' + cep, 'cepnew');
}

function troca_div_ass(flornum) {
    cep = document.fol.cepnew_campo.value;
    showPage22('data.asp?flornum=' + flornum + '&cep=' + cep, 'cepnew');
    document.getElementById("passos").display = "block";

}

function seleciona_cep(cep, flornum) {
    document.fol.cepnew_campo.value = cep;
    troca_div(flornum, 1, 0, 0)
    //showPage22('data.asp?flornum=' + flornum  + '&cep=' + cep, 'cepnew');
}


function mostra_frete(texto_frete, data_texto, data,mostra_acessorio) {
    document.getElementById('data_texto').innerHTML = "" + data_texto
    document.getElementById('cepnew').innerHTML = "<IMG SRC='/imagens/black.gif' width=3 height=10 alt=''><BR>Frete: " + texto_frete
    document.fol.data.value = data
    if (mostra_acessorio=="1"){
        document.getElementById("mostra_acessorio").style.display = "block";
    }
    else {
        document.getElementById("mostra_acessorio").style.display = "none";
    }

    if (document.getElementById('passos')) {
        document.getElementById('passos').style.display = "block"
    }
}
function mostra_rjsd(flornum,cid) {
    document.getElementById('calendario').innerHTML = "<A HREF='javascript:redirectsdrj()'><IMG SRC='/images/rjsd01.jpg'></A><A HREF='javascript:troca_div(" + flornum + "," + cid + ",0,0)'><IMG SRC='/images/rjsd02.jpg'></A>"
    newImage = "url(/images/same03.jpg)";
    //document.getElementById('same03').style.backgroundImage = newImage;
}
function mostra_rjsd2(flornum,cid) {
    document.getElementById('calendario').innerHTML = "<A HREF='javascript:troca_div(" + flornum + "," + cid + ",0,0)'><IMG SRC='/images/rjsd03.jpg'></A>"
    document.getElementById('cepnew').innerHTML = ""
    document.getElementById('data_texto').innerHTML = ""
    //newImage = "url(/images/same03.jpg)";
    //document.getElementById('same03').style.backgroundImage = newImage;
}
function mostra_ddm2010(flornum, cid) {
    document.getElementById('calendario').innerHTML = "<A HREF='javascript:redirectddm2010()'><IMG SRC='/images/ddm2010a.jpg'></A><A HREF='javascript:troca_div(" + flornum + "," + cid + ",0,0)'><IMG SRC='/images/ddm2010b.jpg'></A><A HREF='javascript:pop_ddm2010()'><IMG SRC='/images/ddm2010c.jpg'></A>"
    document.getElementById('cepnew').innerHTML = ""
    document.getElementById('data_texto').innerHTML = ""
    //newImage = "url(/images/same03.jpg)";
    //document.getElementById('same03').style.backgroundImage = newImage;
}

function redirectsdrj() {
    cep = document.fol.cepnew_campo.value;
    window.location = "opcoes.asp?tipo=859&cep=" + cep
}
function redirectddm2010() {
    cep = document.fol.cepnew_campo.value;
    window.location = "opcoes.asp?tipo=1040&cep=" + cep
}
function flipe(X, C) {
    document.images["taba"].src = eval("taba0.src");
    document.images["tabb"].src = eval("tabb0.src");
    document.images["tab" + X].src = eval("tab" + X + C + ".src");


    var go = 0;

    if (X == 'a') {
        if (mytabsA[C] == 0) {
            go = 1;
            mytabsA[C] = 1;
        }
    };
    if (X == 'b') {
        if (mytabsB[C] == 0) {
            go = 1;
            mytabsB[C] = 1
        }
    };

    if (go == 1) {
        showPage('tab.asp?id=' + X + C, 'tab_' + X + C);
    }

    showlayer(ultimo_tab);
    ultimo_tab = "tab_" + X + C;
    showlayer(ultimo_tab);
    //abre(ultimo_tab)
}

function flipeC(X, C) {
    document.images["tab" + X].src = eval("tab" + X + C + ".src");

    var go = 0;
    if (X == 'c') {
        if (mytabsC[C] == 0) {
            go = 1;
            mytabsC[C] = 1;
        }
    };

    //alert('tab.asp?id=' + X + C);

    if (go == 1) {
        //alert('tab.asp?id=a' + C);
        showPage('tab.asp?id=a' + C, 'tab_a' + C);
    }

    showlayer(ultimo_tab);
    ultimo_tab = "tab_a" + C;
    showlayer(ultimo_tab);
    //abre(ultimo_tab)
}


function validar_data(xxx) {
    if (document.getElementById("cepnew_campo")) {
        if (document.getElementById("cepnew_campo").value.length < 8) {
            alert("Por favor defina o CEP de entrega!");
            document.getElementById("cepnew_campo").focus();
            if (xxx==1) {return false;}
            if (xxx == 2) { return; }
        }
        if (document.getElementById('data_texto').innerHTML == "") {
            alert("Por favor defina a data de entrega!");
            if (xxx==1) {return false;}
            if (xxx == 2) { return; }
        }
        
            if (xxx == 2) { document.fol.submit() }
        
    }

}

function abre(camada) {
    xx = camada
    var xs = new getObj(xx);
    lyrheight1 = xs.obj.offsetHeight + 50;

    eval(layerRef + openBracket + camada + closeBracket + styleRef + '.height="' + lyrheight1 + 'px"');

    //var x = new getObj('nutz');
    //lyrheight = x.obj.offsetHeight;
    //lyrheight=lyrheight+lyrheight1
}

function getObj(name) {
    if (document.getElementById) {
        this.obj = document.getElementById(name);
        this.style = document.getElementById(name).style;
    }
    else if (document.all) {
        this.obj = document.all[name];
        this.style = document.all[name].style;
    }
    else if (document.layers) {
        this.obj = document.layers[name];
        this.style = document.layers[name];
    }
}
function nachoxx() {
    aSelects = document.getElementsByTagName("SELECT");

    if (sumidos == 1) {
        for (iCounter = 0; iCounter < aSelects.length; iCounter++) {
            aHiddenSelects[iCounter].style.visibility = "visible";
        }
        sumidos = 0;
    }
    else {
        aHiddenSelects = new Array();

        for (iCounter = 0; iCounter < aSelects.length; iCounter++) {
            aHiddenSelects[aHiddenSelects.length] = aSelects[iCounter];
            aSelects[iCounter].style.visibility = "hidden";
        }
        sumidos = 1;
    }


}
function nacho_ass() {
    //alert("nacho");
    //var variavel = 'popass' 
    
    var variavel = 'popxx' 
    $("a[rel^='" + variavel + "']").prettyPopin({ width: 510, followScroll: false });
}
function nacho(X, C) {
    //$('#somediv_id').buildoverlay();
    var go = 0;

    if (X == 'a') {
        if (mytabsA[C] == 0) {
            go = 1;
            mytabsA[C] = 1;
        }
    };
    if (X == 'b') {
        if (mytabsB[C] == 0) {
            go = 1;
            mytabsB[C] = 1;
        }
    };

    if (go == 1) {
        //alert(id);
        var variavel = 'pop' + X + C
        $("a[rel^='" + variavel + "']").prettyPopin({ width: 510, followScroll: false });
    }
}

function iggy5() {
    var windowprops = "width=550,height=430,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";
    popup_page = "pop_mata.asp"
    window.open(popup_page, "", windowprops);
}

function pop_doutor() { 
    var windowprops = "width=350,height=270,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";
    popup_page="pop_doutor.asp"
    window.open(popup_page, "", windowprops);
}

function pop_ddm2010() {
sealWin=window.open("pop_ddm2010.asp","win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width=400,height=230');
self.name = "mainWin";
}

function pop_Entrega(url) {
sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width=400,height=400');
self.name = "mainWin"; }

function popup(url,x,y) {
    zoom890=window.open(url, "win890",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width='+x+',height='+y);
    self.name = "zoom890"; 
}

function popUp22(url,x,y) {
    sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width='+x+',height='+y);
    self.name = "mainWin"; 
}

function pop_valentine() { 
    var windowprops = "width=201,height=415,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";
    popup_page="pop_valent.asp"
    window.open(popup_page, "", windowprops);
}

function pop_pipoca() {
    window.open("pop_fol_pipoca.asp","popAbt", "scrollbars=0,resizable=0,top=00,left=00,width=600,height=652");
}

function pop_claro() {
    var windowprops ="width=516,height=550,location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
    popup_page="pop_claro4.asp"
    window.open(popup_page, "", windowprops);
} 

function validaQtde(){
    if (document.all["qtde"].value<50){
        alert("No mínimo 50 unidades!");
        return false;
    }
    return true;
}

function pop_mumm() {
    var windowprops = "width=393,height=397,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";
    popup_page = "pop_mumm.asp"
    window.open(popup_page, "", windowprops);
}


function popUp2(url) {
    sealWin = window.open(url, "win", 'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=yes,resizable=no,width=530,height=395');
    self.name = "mainWin";
}



function popResp(url) {
    sealWin = window.open(url, "win", 'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=no,resizable=no,width=487,height=380');
    self.name = "mainWin";
}

function MascaraCEP(formato, keypress, objeto) {
    campo = eval(objeto);
    if (formato == 'cep') {
        caracteres = '01234567890';
        separacoes = 1;
        separacao1 = '-';
        conjuntos = 2;
        conjunto1 = 5;
        conjunto2 = 3;
        if ((caracteres.search(String.fromCharCode(keypress)) != -1) && campo.value.length <
		(conjunto1 + conjunto2 + 1)) {
            if (campo.value.length == conjunto1)
                campo.value = campo.value + separacao1;
        }
        else
            event.returnValue = false;
    }
}

function MascaraCEPxx(formato, keypress, objeto, flornum, disp) {
    //alert(campo.value.length);
    campo = eval(objeto);
    if (formato == 'cep') {
        //if (campo.value.length == 9) { alert("pop"); campo.value = "" };
        caracteres = '01234567890';
        separacoes = 1;
        separacao1 = '-';
        conjuntos = 2;
        conjunto1 = 5;
        conjunto2 = 3;
        if ((caracteres.search(String.fromCharCode(keypress)) != -1) && campo.value.length <
		(conjunto1 + conjunto2 + 1)) {
            if (campo.value.length == conjunto1)
                campo.value = campo.value + separacao1;
        }
        else
            event.returnValue = false;
    }
    if (campo.value.length == 8) {troca_div(flornum,disp,0,0) }
}



function acc_ddm() {
    var windowprops = "width=423,height=545,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";
    popup_page="acessorio_ddm.asp";
    window.open(popup_page, "", windowprops);
}

function pop_valentines() {
    var windowprops = "width=487,height=345,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";
    popup_page = "pop_valentines.asp"
    window.open(popup_page, "", windowprops);
}


function comprarpop() {
    Envia();
    return true;
}

bot_compra1 = new Image();
bot_compra2 = new Image();
bot_compra1.src = "/images/comprar_up.jpg";
bot_compra2.src = "/images/comprar_down.jpg";

function flip_comprar() {
        document.images["bot_compra"].src = bot_compra2.src;
}

function flop_comprar() {
        document.images["bot_compra"].src = bot_compra1.src;
}


var timer = null;
var speed = 1; //1 is  slow
var endTop = 100;
var endLeft = -300;

//******************************************************
// Simple little function to get Elements as an object
//******************************************************
function getEl(id) {
    var el = document.getElementById(id);
    return el;
}
//******************************************************
// Function to show Elements
//******************************************************
function showEl(id) {
    //getEl(id).style.display ="block";
    if (document.getElementById(id)) { getEl(id).style.visibility = "visible"; };
}
//******************************************************
// Function to hide Elements
//******************************************************
function hideEl(id) {
    if (document.getElementById(id)) { getEl(id).style.display = "none"; };

}

//******************************************************
// Function to move Element
//******************************************************
function moveEl(id) {
    var popup = getEl(id);
    var currentTop = parseInt(popup.offsetTop);
    var currentLeft = parseInt(popup.offsetLeft);

    endMove();

    var keepMoving = false;
    Move
    if (currentTop <= endTop) {
        //popup.style.top = (currentTop + speed) + "px";
        keepMoving = true;
    }
    if (currentLeft <= endLeft) {
        //popup.style.left = (currentLeft + speed) + "px";
        keepMoving = true;
    }
    if (keepMoving) {
        //startMove(id);
    }
    else {
        //endMove();
    }

}
//******************************************************
// Function to start the move
//******************************************************
function startMove(id) {
    timer = setTimeout("moveEl('" + id + "')", 14);
}
//******************************************************
// Function to end the move
//******************************************************
function endMove() {
    clearTimeout(timer);
    setTimeout(' fechar()', 30000);
}
//******************************************************
// Function timer
//******************************************************

function fechar() {
    document.getElementById('popup').style.display = "none";
}

var xmlHttp
var localWhereToPut
var xmlHttp22
var localWhereToPut22
var xmlHttp33
var localWhereToPut33
var tipo

function showPage(pageToFetch, whereToPut) {
    xmlHttp = GetXmlHttpObject()
    if (xmlHttp == null) {
        alert("Sorry you cannot run AJAX Applications.")
        return
    }
    var url = pageToFetch
    localWhereToPut = whereToPut
    //url=url+"?q="
    //url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange = stateChanged
    xmlHttp.open("GET", url, true)
    xmlHttp.send(null)
}
function stateChanged() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
        document.getElementById(localWhereToPut).innerHTML = xmlHttp.responseText
        localWhereToPut = ""
        nacho_ass();
    }
}

function showPage22(pageToFetch22, whereToPut22) {
    xmlHttp22 = GetXmlHttpObject22()
    if (xmlHttp22 == null) {
        alert("Sorry you cannot run AJAX Applications.")
        return
    }
    var url = pageToFetch22
    localWhereToPut22 = whereToPut22
    xmlHttp22.onreadystatechange = stateChanged22
    xmlHttp22.open("GET", url, true)
    xmlHttp22.send(null)
}

function showPage_ass(pageToFetch22, whereToPut22) {
    xmlHttp22 = GetXmlHttpObject22()
    if (xmlHttp22 == null) {
        alert("Sorry you cannot run AJAX Applications.")
        return
    }
    var url = pageToFetch22
    localWhereToPut22 = whereToPut22
    xmlHttp22.onreadystatechange = stateChanged_ass
    xmlHttp22.open("GET", url, true)
    xmlHttp22.send(null)
}

function showPage33(pageToFetch33, whereToPut33, tipoxx) {
    tipo = tipoxx;
    xmlHttp33 = GetXmlHttpObject33()
    if (xmlHttp33 == null) {
        alert("Sorry you cannot run AJAX Applications.")
        return
    }
    var url = pageToFetch33
    localWhereToPut33 = whereToPut33
    xmlHttp33.onreadystatechange = stateChanged33
    xmlHttp33.open("GET", url, true)
    xmlHttp33.send(null)
}



function stateChanged_ass() {
    if (xmlHttp22.readyState == 4 || xmlHttp22.readyState == "complete") {
        document.getElementById('data_texto').innerHTML = ""

        document.getElementById(localWhereToPut22).innerHTML = xmlHttp22.responseText
        localWhereToPut22 = ""


        nacho_ass();
    }
}

function stateChanged22() {
    if (xmlHttp22.readyState == 4 || xmlHttp22.readyState == "complete") {
        document.getElementById('data_texto').innerHTML = ""

        document.getElementById(localWhereToPut22).innerHTML = xmlHttp22.responseText
        localWhereToPut22 = ""
        proxima_data = document.fol.proxima_data.value;
        proxima_frete = document.fol.proxima_frete.value;
        dataxxx = document.fol.dataxxx.value;
        selecaoxxx = document.fol.selecaoxxx.value;
        document.fol.data.value = dataxxx;
        //document.fol.data.value = data

        if (selecaoxxx != "") {
            troca_fundo(selecaoxxx);
        }

        mostra_acessorioxx = document.fol.mostra_acessorioxx.value;

        document.getElementById('data_texto').innerHTML = "" + proxima_data
        document.getElementById('cepnew').innerHTML = "" + proxima_frete

        //alert(document.fol.transito.value);
        //transito = document.fol.transito.value;
        //if (transito<10){document.getElementById('ddm2011_' + transito ).style.display = "block";}
        
           

        //document.getElementById('data').value = dataxx;
        if (mostra_acessorioxx == "1") {
            document.getElementById("mostra_acessorio").style.display = "block";
        }
        else {
            document.getElementById("mostra_acessorio").style.display = "none";
        }
    }
}
function stateChanged33() {
    if (xmlHttp33.readyState == 4 || xmlHttp33.readyState == "complete") {
        document.getElementById(localWhereToPut33).innerHTML = xmlHttp33.responseText
        localWhereToPut33 = ""
        document.getElementById("polling").style.display = "none";

        //alert(tipo);
        if ((tipo == "1") && (document.getElementById('nome').value == "")) {
            picnum = document.testexx.picnumxx.value;
            document.getElementById('picnum').value = picnum;

            nome = document.testexx.nomexx.value;
            document.getElementById('nome').value = nome;

            ddd = document.testexx.dddxx.value;
            telefone = document.testexx.telefonexx.value;
            document.getElementById('telefone').value = ddd + ' ' + telefone;

            celular = document.testexx.celularxx.value;
            document.getElementById('celular').value = ddd + ' ' + celular;

            email = document.testexx.emailxx.value;
            document.getElementById('email').value = email;
        }

        if ((tipo == "2") && (document.getElementById('nome').value == "")) {
            picnum = document.testexx.picnumxx.value;
            document.getElementById('picnum').value = picnum;

            nome = document.testexx.nomexx.value;
            document.getElementById('nome').value = nome;

            ddd = document.testexx.dddxx.value;
            telefone = document.testexx.telefonexx.value;
            document.getElementById('telefone').value = ddd + ' ' + telefone;

            celular = document.testexx.celularxx.value;
            document.getElementById('celular').value = ddd + ' ' + celular;

            email = document.testexx.emailxx.value;
            document.getElementById('email').value = email;

            if (picnum != "") {
                pesquisa_lista_pedidos(picnum);
            }
        }


    }
}

function GetXmlHttpObject() {
    var objXMLHttp = null
    if (window.XMLHttpRequest) {
        objXMLHttp = new XMLHttpRequest()
    }
    else if (window.ActiveXObject) {
        objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP")
    }
    return objXMLHttp
}
function GetXmlHttpObject22() {
    var objXMLHttp22 = null
    if (window.XMLHttpRequest) {
        objXMLHttp22 = new XMLHttpRequest()
    }
    else if (window.ActiveXObject) {
        objXMLHttp22 = new ActiveXObject("Microsoft.XMLHTTP")
    }
    return objXMLHttp22
}
function GetXmlHttpObject33() {
    var objXMLHttp33 = null
    if (window.XMLHttpRequest) {
        objXMLHttp33 = new XMLHttpRequest()
    }
    else if (window.ActiveXObject) {
        objXMLHttp33 = new ActiveXObject("Microsoft.XMLHTTP")
    }
    return objXMLHttp33
}

var http_request = false;
var localWhereToPut = "";

function makePOSTRequest(url, parameters, whereToPut) {
    http_request = false;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            // set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
        }
    } 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('Cannot create XMLHTTP instance');
        return false;
    }
    localWhereToPut = whereToPut;
    http_request.onreadystatechange = alertContents;
    http_request.open('POST', url, true);
    http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    http_request.setRequestHeader("Content-length", parameters.length);
    http_request.setRequestHeader("Connection", "close");
    http_request.send(parameters);
}

function alertContents() {
    if (http_request.readyState == 4) {
        if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById(localWhereToPut).innerHTML = result;
        } else {
            alert('There was a problem with the request.');
        }
    }
}

function get(obj, whichPage, whereToPut, whatToPost) {
    makePOSTRequest(whichPage, whatToPost, whereToPut);
}

function showlayer(layer) {
    //alert(layer)
	var myLayer=document.getElementById(layer).style.display;
	if(myLayer=="none"){
		document.getElementById(layer).style.display="block";
	} else { 
		document.getElementById(layer).style.display="none";
		}
}
