﻿// IE5.5+ PNG Alpha Fix v2.0 Alpha: Background Tiling Support
// (c) 2008 Angus Turnbull http://www.twinhelix.com

// This is licensed under the GNU LGPL, version 2.1 or later.
// For details, see: http://creativecommons.org/licenses/LGPL/2.1/

var IEPNGFix = window.IEPNGFix || {};

IEPNGFix.tileBG = function(elm, pngSrc, ready) {
    // Params: A reference to a DOM element, the PNG src file pathname, and a
    // hidden "ready-to-run" passed when called back after image preloading.

    var data = this.data[elm.uniqueID],
		elmW = Math.max(elm.clientWidth, elm.scrollWidth),
		elmH = Math.max(elm.clientHeight, elm.scrollHeight),
		bgX = elm.currentStyle.backgroundPositionX,
		bgY = elm.currentStyle.backgroundPositionY,
		bgR = elm.currentStyle.backgroundRepeat;

    // Cache of DIVs created per element, and image preloader/data.
    if (!data.tiles) {
        data.tiles = {
            elm: elm,
            src: '',
            cache: [],
            img: new Image(),
            old: {}
        };
    }
    var tiles = data.tiles,
		pngW = tiles.img.width,
		pngH = tiles.img.height;

    if (pngSrc) {
        if (!ready && pngSrc != tiles.src) {
            // New image? Preload it with a callback to detect dimensions.
            tiles.img.onload = function() {
                this.onload = null;
                IEPNGFix.tileBG(elm, pngSrc, 1);
            };
            return tiles.img.src = pngSrc;
        }
    } else {
        // No image?
        if (tiles.src) ready = 1;
        pngW = pngH = 0;
    }
    tiles.src = pngSrc;

    if (!ready && elmW == tiles.old.w && elmH == tiles.old.h &&
		bgX == tiles.old.x && bgY == tiles.old.y && bgR == tiles.old.r) {
        return;
    }

    // Convert English and percentage positions to pixels.
    var pos = {
        top: '0%',
        left: '0%',
        center: '50%',
        bottom: '100%',
        right: '100%'
    },
		x,
		y,
		pc;
    x = pos[bgX] || bgX;
    y = pos[bgY] || bgY;
    if (pc = x.match(/(\d+)%/)) {
        x = Math.round((elmW - pngW) * (parseInt(pc[1]) / 100));
    }
    if (pc = y.match(/(\d+)%/)) {
        y = Math.round((elmH - pngH) * (parseInt(pc[1]) / 100));
    }
    x = parseInt(x);
    y = parseInt(y);

    // Handle backgroundRepeat.
    var repeatX = { 'repeat': 1, 'repeat-x': 1}[bgR],
		repeatY = { 'repeat': 1, 'repeat-y': 1}[bgR];
    if (repeatX) {
        x %= pngW;
        if (x > 0) x -= pngW;
    }
    if (repeatY) {
        y %= pngH;
        if (y > 0) y -= pngH;
    }

    // Go!
    this.hook.enabled = 0;
    if (!({ relative: 1, absolute: 1}[elm.currentStyle.position])) {
        elm.style.position = 'relative';
    }
    var count = 0,
		xPos,
		maxX = repeatX ? elmW : x + 0.1,
		yPos,
		maxY = repeatY ? elmH : y + 0.1,
		d,
		s,
		isNew;
    if (pngW && pngH) {
        for (xPos = x; xPos < maxX; xPos += pngW) {
            for (yPos = y; yPos < maxY; yPos += pngH) {
                isNew = 0;
                if (!tiles.cache[count]) {
                    tiles.cache[count] = document.createElement('div');
                    isNew = 1;
                }
                var clipR = (xPos + pngW > elmW ? elmW - xPos : pngW),
					clipB = (yPos + pngH > elmH ? elmH - yPos : pngH);
                d = tiles.cache[count];
                s = d.style;
                s.behavior = 'none';
                s.left = xPos + 'px';
                s.top = yPos + 'px';
                s.width = clipR + 'px';
                s.height = clipB + 'px';
                s.clip = 'rect(' +
					(yPos < 0 ? 0 - yPos : 0) + 'px,' +
					clipR + 'px,' +
					clipB + 'px,' +
					(xPos < 0 ? 0 - xPos : 0) + 'px)';
                s.display = 'block';
                if (isNew) {
                    s.position = 'absolute';
                    s.zIndex = -999;
                    if (elm.firstChild) {
                        elm.insertBefore(d, elm.firstChild);
                    } else {
                        elm.appendChild(d);
                    }
                }
                this.fix(d, pngSrc, 0);
                count++;
            }
        }
    }
    while (count < tiles.cache.length) {
        this.fix(tiles.cache[count], '', 0);
        tiles.cache[count++].style.display = 'none';
    }

    this.hook.enabled = 1;

    // Cache so updates are infrequent.
    tiles.old = {
        w: elmW,
        h: elmH,
        x: bgX,
        y: bgY,
        r: bgR
    };
};


IEPNGFix.update = function() {
    // Update all PNG backgrounds.
    for (var i in IEPNGFix.data) {
        var t = IEPNGFix.data[i].tiles;
        if (t && t.elm && t.src) {
            IEPNGFix.tileBG(t.elm, t.src);
        }
    }
};
IEPNGFix.update.timer = 0;

if (window.attachEvent && !window.opera) {
    window.attachEvent('onresize', function() {
        clearTimeout(IEPNGFix.update.timer);
        IEPNGFix.update.timer = setTimeout(IEPNGFix.update, 100);
    });
}

/* ------------------------------------- */


nie = (navigator.appName.indexOf("Microsoft") == -1);

function getel(doc, id) {
    return doc.getElementById(id);
}

function el(id) {
    return getel(document, id);
}

function getElementsById(sId) {
    var outArray = new Array();

    if (typeof (sId) != 'string' || !sId) {
        return outArray;
    };

    if (document.evaluate) {
        var xpathString = "//*[@id='" + sId.toString() + "']"
        var xpathResult = document.evaluate(xpathString, document, null, 0, null);
        while ((outArray[outArray.length] = xpathResult.iterateNext())) { }
        outArray.pop();
    }
    else if (document.all) {

        if (document.all[sId])
            for (var i = 0, j = document.all[sId].length; i < j; i += 1) {
                outArray[i] = document.all[sId][i];
            }

    } else if (document.getElementsByTagName) {

        var aEl = document.getElementsByTagName('*');
        for (var i = 0, j = aEl.length; i < j; i += 1) {

            if (aEl[i].id == sId) {
                outArray.push(aEl[i]);
            };
        };

    };

    if ((outArray.length == 0) && (el(sId)))
        outArray[0] = el(sId);

    return outArray;
}

function escreve(s) {
    document.write(s);
}

function adjust1() {
    if (el('k0'))
        el('k0').style.display = 'none';
    if (el('k1'))
        el('k1').style.display = 'none';
    if (el('k2'))
        el('k2').style.display = 'none';
    if (el('lr'))
        el('lr').style.display = 'none'
}

function arr(n) {
    this.length = n
    for (var i = 0; i < n; i = i + 1) {
        this[i] = ''
    }
}

function element_top(el) {
    var et = 0
    while (el) {
        et += el.offsetTop
        el = el.offsetParent
    }
    return et
}


function element_left(el) {
    var et = 0
    while (el) {
        et += el.offsetLeft
        el = el.offsetParent
    }
    return et
}

/* 19/05/2008 */
function escreveFlash(id, src, width, height, align, salign, transparent, mozila, versao, onmouseover, onmouseout) {
    s = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + (versao) + ',0,0,0" width="' +
        (width) + '" height="' + (height) + '" id="' +
        id + '" ' + (align != '' ? 'align="' + align + '"' : '') +
        (onmouseover != '' ? ' onmouseover="' + onmouseover + '"' : '') +
        (onmouseout != '' ? ' onmouseout="' + onmouseout + '"' : '') +
        '><param name="quality" value="high" />' +
        (src != '' ? '<param name="movie" value="' + src + '" />' : '') +
        (salign != '' ? '<param name="salign" value="' + salign + '" />' : '') +
        (transparent ? '<param name="wmode" value="transparent" />' : '') +
        '<param name="menu" value="false" /><param name="scale" value="noscale" />';
    if (mozila)
        s += '<embed ' +
            (src != '' ? 'src="' + src + '" ' : '') +
            'loop="false" menu="false" quality="high" scale="noscale" width="' +
            (width) + '" height="' + (height) + '" name="' + id + '" ' +
            (align != '' ? 'align="' + align + '" ' : '') +
            (salign != '' ? 'salign="' + salign + '" ' : '') +
            (onmouseover != '' ? 'onmouseover="' + onmouseover + '" ' : '') +
            (onmouseout != '' ? 'onmouseout="' + onmouseout + '" ' : '') +
            (transparent ? 'wmode="transparent" ' : '') +
            'allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" swliveconnect="true" />';
    s += '</object>';
    escreve(s);
}

function loadFlashWithPreload(id, src, preloadId, paramsStr) {
    preloaded = movieIsLoaded(mv(preloadId));
    loaded = movieIsLoaded(mv(id));

    if ((!loaded) && (preloaded)) {
        cmd = 'loadMovie(\'' + id + '\', \'' + src + '\', [' + paramsStr + '])';
        setTimeout(cmd, 1);
        setTimeout(cmd, 500);
    }

    paramsStr = paramsStr.replace(/\'/g, '\\\'');
    cmd = 'loadFlashWithPreload(\'' + id + '\', \'' + src + '\', \'' + preloadId + '\', \'' + paramsStr + '\')';

    if ((loaded) && (nie))
        setTimeout(cmd, 1000);
    else if (!loaded)
        setTimeout(cmd, 100);

}

function mv(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1)
        return document.all[movieName]
    else if (document[movieName])
        return document[movieName]
    else
        return el(movieName)
}
function loadMovie(id, movie, params) {
    mv(id).LoadMovie(0, movie);
    for (p = 0; p < params.length; p += 2)
        mv(id).SetVariable(params[p], params[p + 1]);
}

function loadMovieWithDelay(id, movie, paramsStr) {
    cmd = 'loadMovie(\'' + id + '\', \'' + movie + '\', ' + paramsStr + ')';
    setTimeout(cmd, 500);
}

function movieIsLoaded(theMovie) {
    if (typeof (theMovie) != "undefined") {
        return ((typeof (theMovie.PercentLoaded) != "undefined") && (theMovie.PercentLoaded() == 100));
    } else {
        return false;
    }
}

function movieIsReady(theMovie) {
    return (typeof (theMovie.PercentLoaded) != "undefined");
}

function ampliar(id, pw, ph, base) {
    if (pw > 760)
        pw = 760;
    if (ph > 570)
        ph = 570;

    w = (screen.width - 30);
    w = pw + 10 > w ? w : pw + 10;
    h = (screen.height - 30);
    h = ph + 10 > h ? h : ph + 10;

    janela = window.open('about:blank', 'pict_big', 'toolbar=no,location=no,directories=no,status=yes,scrollbars=no,resizable=no,menubar=no,width=' + (w) + ',height=' + (h) + ',top=' + (((screen.height - h) / 2) - 30) + ',left=' + (((screen.width - w) / 2) - 10))
    janela.document.write('<HTML><TITLE>Imagem ampliada</TITLE>');
    janela.document.write('<BODY style="margin: 0px; padding: 0px">');
    janela.document.write('<TABLE BORDER=0 cellpadding=0 cellspacing=0 width=100% height=100%><TR><TD width=100% height=100% align=center valign=middle>');
    janela.document.write('<A HREF="" onclick="window.close(); return false"><IMG id=pic ALT="Clique para fechar" SRC="' + base + 'ModuleHandlers/Content/picture.aspx?idContentPicture=' + (id) + '&w=' + (janela.document.body.clientWidth - 10) + '&h=' + (janela.document.body.clientHeight - 10) + '" BORDER=0 style="border: 1px solid gray"></a>');
    janela.document.write('</TD></TR></TABLE></BODY></HTML>');

    janela.focus()

}

function newImage(arg) {
    if (document.images) {
        rslt = new Image();
        rslt.src = arg;
        return rslt;
    }
}

function imprime() {
    window.focus();
    setTimeout("window.print()", 500);
}

var ie5 = document.all && !window.opera
var lastHeight = 0;
var autoHeight = 1;
var autoHSet = 0;
function adjustIFrameSize() {
    if (!el('general'))
        return;

    iframeElement = getel(window.parent.document, 'ifcontent');
    iframeWindow = window.parent.frames[name];
    if (nie) {
        iframeElement.style.height = '';
    }
    h = 0;
    hMin = 0;
    h = el('general').offsetHeight;

    hMin = 377;
    h = h > hMin ? h : hMin;

    lastHeight = h;

    iframeElement.style.height = (h) + 'px';

    if ((autoHeight) && (!autoHSet)) {
        autoHSet = 1;
        setTimeout('autoH()', 500);
    }
}

function autoH() {
    h = el('general').offsetHeight;
    hMin = 377;
    h = h > hMin ? h : hMin;

    if (h != lastHeight) {
        scrollPos = window.parent.document.documentElement.scrollTop;
        adjustIFrameSize();
        window.parent.document.documentElement.scrollTop = scrollPos;
    }
    setTimeout('autoH()', 500);
}

var elementosFonte = '';
function fonte(aumenta) {
    // default
    dif = Number(readCookie('fontSize'));

    els = elementosFonte.split(',');

    for (i = 0; i < els.length; i++) {

        if (els[i].substr(0, 1) == '_') {
            dfs = getElementsById(els[i].substr(1, els[i].length - 1));
        }
        else
            dfs = [el(els[i])];

        for (xx = 0; xx < dfs.length; xx++) {
            df = dfs[xx];
            if (!df)
                continue;
            def = Number(df.getAttribute('default-font', 0));
            if (aumenta > -1) {
                size = Number(df.style.fontSize.substr(0, df.style.fontSize.length - 2));
                dif = size - def;
            }
            else {
                dif = Number(readCookie('fontSize'));
                size = def + dif;
            }
            //alert(els[i] + ' default: ' + (def) + ' atual: ' + (size));

            if (aumenta > -1) {
                if ((dif <= 0) && !aumenta) {
                    alert(fonteMinTxt);
                    return;
                }
                if ((dif >= 4) && aumenta) {
                    alert(fonteMaxTxt);
                    return;
                }
                if (aumenta)
                    size++;
                else
                    size--;
            }

            dif = size - def;

            df.style.fontSize = (size) + "px";
        }
    }

    var expire = new Date();
    expire.setTime(new Date().getTime() + 3600000 * 24 * 5000);
    document.cookie = 'fontSize' + "=" + escape((dif) + '') + ";expires=" + expire.toGMTString();

    adjustIFrameSize();
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}

function indica() {
    ifc = window.parent.frames['ifcontent'];
    iurl = 'indique.aspx?1=1';
    if (ifc) {
        if (ifc.idcontent != 0)
            iurl += '&idContent=' + (ifc.idcontent);
        if (ifc.idcontentsection != 0)
            iurl += '&idContentSection=' + (ifc.idcontentsection);
        ifc.location = htmlbase + iurl;
    }
    else
        window.location = iurl;
}

function abreGaleria(id, idContentPicture) {
    janela = window.open(htmlbase + 'galeria.aspx?idContent=' + (id) + (typeof (idContentPicture) != 'undefined' ? '&idContentPicture=' + (idContentPicture) : ""), 'galeria', 'toolbar=no,location=no,directories=no,status=yes,scrollbars=no,resizable=no,menubar=no,width=611,height=477,top=' + ((screen.height - 477) / 2) + ',left=' + ((screen.width - 611) / 2));
    janela.focus();
    return false;
}

function busca(ifc) {
    s = 'busca.aspx?p=' + document.forms['fbusca'].p.value;
    abre(s, ifc);
}

function cadastraNews(ifc) {
    s = 'maillist.aspx?email=' + document.forms['fnews'].email.value;
    abre(s, ifc);
}

function abre(url, ifc) {
    if (ifc)
        window.parent.frames['ifcontent'].location = url;
    else
        window.location = 'padrao.aspx?' + url;
}


function amplia2(id, pw, ph, text) {
    wp = window.parent;
    wpd = wp.document;
    ov = getel(wpd, 'overlay');
    amp = getel(wpd, 'ampliacao');
    ampi = getel(wpd, 'ampliInner');
    img = getel(wpd, 'imgAmpliar2');
    txt = getel(wpd, 'ampliText');

    ampi.style.width = (pw + 12) + 'px';
    ov.style.height = (wpd.documentElement.scrollHeight) + 'px';
    img.src = wp.htmlbase + 'images/blank.gif';
    txt.style.display = (text != '' ? 'block' : 'none');
    txt.innerHTML = text;

    th = wpd.documentElement.clientHeight;
    th = ((th - ph - 12 - 18 - 3) / 2) - 20;
    if (th < 0)
        th = 0;
    th = th + window.parent.document.documentElement.scrollTop;
    ampi.style.marginTop = (th) + 'px';

    ov.style.display = 'block';
    amp.style.display = 'block';

    img.src = wp.htmlbase + 'ModuleHandlers/Content/picture.aspx?idContentPicture=' +
        (id) + '&w=' + (pw) + '&h=' + (ph);
}

function fechaAmpliar2() {
    wp = window.parent;
    wpd = wp.document;
    img = getel(wpd, 'imgAmpliar2');
    txt = getel(wpd, 'ampliText');
    ov = getel(wpd, 'overlay');
    amp = getel(wpd, 'ampliacao');

    ov.style.display = 'none';
    amp.style.display = 'none';
    img.src = '';
    txt.innerHTML = '';
}



/* ----------------------------------------------- */

var menuItens = new arr(0);
var menuComplete = 0;
var menuLoaded = 0;

function addMenuItem(id, src, preloadId, paramsStr) {
    menuItens.length++;
    i = menuItens.length - 1;
    menuItens[i] = new arr(4);
    menuItens[i][0] = id;
    menuItens[i][1] = src;
    menuItens[i][2] = preloadId;
    menuItens[i][3] = paramsStr;
}

function menuDone() {
    menuComplete = 1;
}

function mostraMenu() {
    preloaded = movieIsLoaded(mv('menuPreload'));
    loaded = movieIsLoaded(mv('menuPreload'));

    if ((!menuComplete) || (!preloaded) || (!loaded))
        setTimeout('mostraMenu()', 100);
    else if (!menuLoaded) {
        menuLoaded = 1;
        for (i = 0; i < menuItens.length; i++) {
            cmd = 'loadMovie(\'' + menuItens[i][0] + '\', \'' + menuItens[i][1] + '\', [' + menuItens[i][3] + '])';
            setTimeout(cmd, i * 100);

            // para manter visivel no mozila
            menuItens[i][3] = menuItens[i][3].replace(/\'/g, '\\\'');
            cmd = 'loadFlashWithPreload(\'' + menuItens[i][0] + '\', \'' + menuItens[i][1] + '\', \'' + menuItens[i][2] + '\', \'' + menuItens[i][3] + '\')';
            setTimeout(cmd, (i * 100) + 1000);
        }
    }
}

function adjust() {
    bw = el('box-wrapper');
    if (bw) {
        h = bw.offsetHeight;
        max = 355;
        if (h < max)
            bw.style.marginTop = ((max - h) / 2) + 'px';
        else if (max - h > 25)
            bw.style.marginTop = '25px';
        else
            bw.style.marginTop = (max - h) + 'px';
    }

    rb = el('right-border');
    if (rb)
        rb.style.marginLeft = (document.documentElement.offsetWidth > 800 ? '380px' : '379px');

    mb = el('mainbgs');
    if (mb)
        mb.style.width = (document.documentElement.offsetWidth > 800 ? '780px' : '779px');

    setTimeout('adjust()', 500);
}

function umclique(base, sel) {
    val = sel.options[sel.selectedIndex].value;
    if (val != '')
        window.location = base + val;
}

// *********************************************************************************************************************

activeMenu = 0;

function getel(doc, id) {
    if (doc.all)
        return doc.all[id];
    else
        return doc.getElementById(id);
}

var timeid = 0;

function debugMenu(s) {
    el('txtteste').value = s + '\n' + el('txtteste').value;
}

function abreMenu(e, id) {
    
    // debugMenu('abreMenu1');
    
    window.isOverButton = id;
    window.isOverMenu = 0;

    showmenu_src = ie5 ? e.srcElement : e.target;
    showmenu_which = eval('ms' + id);
    showmenu_id = id;
    
    // debugMenu('hidemenu pela abremenu');

    hidemenu();
    clearhidemenu()

    clearTimeout(timeid);
    timeid = setTimeout('showmenu()', 200);

    // debugMenu('abreMenu2');
}
function fechaMenu(id, subitens) {
    // debugMenu('fechaMenu');
    
    if (id == window.isOverButton) {
        window.isOverButton = 0;
        delayhidemenu();
    }
}

var defaultMenuWidth = 120;

var ie5 = document.all && !window.opera
var ns6 = document.getElementById

// já escrito. problema de posicionamento
dsm = ie5 ? document.all.divSubMenu : document.getElementById("divSubMenu")

function iecompattest() {
    return (document.compatMode && document.compatMode.indexOf("CSS") != -1) ? document.documentElement : document.body
}

function element_top(el) {
    var et = 0
    while (el) {
        et += el.offsetTop
        el = el.offsetParent
    }
    return et
}

function element_left(el) {
    var et = 0
    while (el) {
        et += el.offsetLeft
        el = el.offsetParent
    }
    return et
}

var showmenu_src = 0;
var showmenu_which = 0;
var showmenu_id = 0;

function showmenu(src, which, id) {

    // debugMenu('showmenu');

    src = showmenu_src;
    which = showmenu_which;
    id = showmenu_id;

    mv('m' + id).SetVariable('hideOver', 'no');
    mv('m' + id).SetVariable('isOverSub', 'yes');
    activeMenu = id;
    if (!document.all && !document.getElementById)
        return
    menuobj = el('divSubMenu')
    menuobj.innerHTML = '<table id=tbMenu border=0 cellpadding=0 cellspacing=0>' + which + '</table>';
    menuobj.style.width = (getel(document, 'tbMenu').offsetWidth > defaultMenuWidth ? getel(document, 'tbMenu').offsetWidth : defaultMenuWidth) + "px";
    getel(document, 'tbMenu').style.width = menuobj.style.width;

    //menuobj.style.width=defaultMenuWidth;
    menuobj.contentwidth = menuobj.offsetWidth
    menuobj.contentheight = menuobj.offsetHeight
    if (!ie5)
        menuobj.style.top = element_top(src) + 0 + "px";
    else
        menuobj.style.top = element_top(src) + 0 + "px";

    menuobj.style.left = element_left(src) + 143 + "px";

    menuobj.style.visibility = "visible"
    
    // debugMenu('showmenu2');
    
    return false
}

function contains_ns6(a, b) {
    while (b.parentNode)
        if ((b = b.parentNode) == a)
        return true;
    return false;
}

function hidemenu(porDelay) {
    
    // debugMenu('hidemenu ' + (porDelay) + ' ');
    
    if (window.menuobj) {
        menuobj.style.visibility = "hidden"
        mv('m' + activeMenu).SetVariable('isOverSub', 'no');
        mv('m' + activeMenu).SetVariable('hideOver', 'yes');
    }
}

function dynamichide(e) {
    if (!window.isOverButton) {
        
        // debugMenu('dynamichide');
        
        if (ie5 && !menuobj.contains(e.toElement)) {
            // debugMenu('hidemenu pela dynamichide');
            hidemenu()
        }
        else if (ns6 && e.currentTarget != e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget)) {
            // debugMenu('hidemenu pela dynamichide');
            hidemenu()
        }
    }
}

function delayhidemenu() {
    if (!window.isOverMenu)
        window.delayhide = setTimeout("hidemenu(1)", 500)
}

function clearhidemenu() {
    if (window.delayhide)
        clearTimeout(delayhide)
}

if (ie5 || ns6)
    document.onclick = hidemenu

/* ----------------------------------------------- */

function loadBanners() {
    el('bannerBanner').innerHTML = mainBanner;
    mostraBanner();
}

function mostraBanner() {
    if (bannerIsLoaded('banner0') || (nie)) {
        el('bannerCarregando').style.display = 'none';
        if (!nie) {
            oDiv = el('bannerBanner');
            oDiv.style.filter = "blendTrans(duration=0.5)";
            oDiv.filters.blendTrans.apply();
            oDiv.filters.blendTrans.play();
        }
        el('divbanner0').style.display = 'block';
    }
    else {
        setTimeout('mostraBanner()', 100);
    }

}

function bannerIsLoaded(id) {
    if ((mv(id).tagName == 'EMBED') || (mv(id).tagName == 'OBJECT'))
        return movieIsLoaded(mv(id));
    else if (mv(id).tagName == 'IMG')
        return el(id).complete;
}

function contentBeforePrint() {
    getel(window.parent.document, 'ifcontent').style.height = (getel(window.parent.document, 'ifcontent').offsetHeight + 150) + 'px';
}

function contentAfterPrint() {
    getel(window.parent.document, 'ifcontent').style.height = (getel(window.parent.document, 'ifcontent').offsetHeight - 150) + 'px';
}

function onclickz(name) {
    var opcoes = document.getElementsByName(name)
    for (var i = 0; i < opcoes.length; i++) {
        var op = opcoes[i];
        op.style.display = 'block';
    }
}

function onclickOption(op) {
    el('lista_tipo').style.display = 'none';
    el('lista_segmento').style.display = 'none';
    getel(window.frames['produtos'].document, 'lista_tipo').style.display = 'none';
    getel(window.frames['produtos'].document, 'lista_segmento').style.display = 'none';
    el(op).style.display = 'block';
    getel(window.frames['produtos'].document, op).style.display = 'block';
    window.frames['produtos'].lista = getel(window.frames['produtos'].document, op).getElementsByTagName("li");
    clicado = op == 'lista_tipo' ? 'lista_segmento' : 'lista_tipo';
    click = 0;
    document.getElementById('cxfiltro').focus();
}

function onclickOptionBox() {
    var lista_tipo = el('lista_tipo').style.display == 'block' ? 1 : 0;
    var lista_segmento = el('lista_segmento').style.display == 'block' ? 1 : 0;    
    if (click == 0) {
        el('lista_tipo').style.display = 'block';
        el('lista_segmento').style.display = 'block';
        click = 1;
    } else {
        el(clicado).style.display = 'none';
        click = 0;      
    }    
}

var clicado = 'lista_segmento';
var click = 0;
var timeoutid = 0;
var opcao_lista = "lista_tipo";

function filtrar(p) {
    window.clearTimeout(timeoutid);
    timeoutid = window.setTimeout('filtrar2(\'' + p.toLowerCase() + '\')', 300);    
}

function filtrar2(p) {
    var lista = window.frames['produtos'].lista;
    filtrar5(lista, p, 'yellow');
}

function destaca(s, pos, p, cor) {
    return s.substr(0, pos) + '<FONT color="' + cor + '">' + s.substr(pos, p.length) + '</FONT>' + s.substr(pos + p.length, s.length);
}

function filtrar3(p) {
    window.clearTimeout(timeoutid);
    timeoutid = window.setTimeout('filtrar4(\'' + p.toLowerCase() + '\')', 300);
}

function filtrar4(p) {
    lista = el('lista_secoes').getElementsByTagName("li");
    filtrar5(lista, p, 'black');
}

function filtrar5(lista, p, cor) {
    for (var i = 0; i < lista.length; i++) {
        var op = lista[i];
        texto = op.getElementsByTagName('A')[0].innerHTML;
        texto = removeHTMLTags(texto);
        if (p != '') {
            pos = texto.toLowerCase().indexOf(p);
            op.style.display = pos == -1 ? 'none' : 'block';
            if (pos > -1)
                texto = destaca(texto, pos, p, cor);
        }
        else
            op.style.display = 'block';
        op.getElementsByTagName('A')[0].innerHTML = texto;
    }
}

function removeHTMLTags(strInputCode) {
    strInputCode = strInputCode.replace(/&(lt|gt);/g, function(strMatch, p1) {
        return (p1 == "lt") ? "<" : ">";
    });
    return strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
}