active = "#FF0000"
visited = "#00FF00"
deflink = "#0000FF"

function isIE(){
    return (document.all) ? 1 : 0;
}

function isNS(){
    return (document.layers && !isIE() && !isFF()) ? 1 : 0;
}

function isFF(){
    return (document.getElementById && !isIE() && !isNS()) ? 1 : 0;
}

function isOT(){
    return ((!isIE()) && (!isNS()) && (!isFF())) ? 1 : 0;
}

function ShowPlayer(snd, lp){
    if (lp == -1) 
        lp = 999;
    document.write("<div style='position:absolute; visibility:visible; TOP: 0px; LEFT: 105px; z-index:1001;'><embed src='" + snd + "' playcount= '" + lp + "' loop='1' type='application/x-mplayer2' showcontrols='1' showtracker='0' enablecontextmenu='0' width='68' height='40'></embed></div>");
}

function notShowPlayer(snd, lp){
    if (isIE()) 
        document.write("<bgsound src='" + snd + "' loop=" + lp + ">");
    else {
        if (lp == -1) 
            lp = 999;
        document.write("<embed src='" + snd + "' playcount= '" + lp + "' loop='1' type='application/x-mplayer2' showcontrols='0' showtracker='0' enablecontextmenu='0' width='0' height='0'></embed>");
    }
}

function playSound(snd, lp){
    if (isIE()) 
        document.write("<bgsound src='" + snd + "' loop=" + lp + ">");
    else 
        ShowPlayer(snd, lp);
}

function playSnd(snd, lp, shw){
    if (shw) 
        playSound(snd, lp);
    else 
        notShowPlayer(snd, lp);
}

function mousein(src, fondoin){
    src.style.cursor = 'pointer';
    src.bgColor = fondoin;
}

function mouseout(src, fondout){
    src.style.cursor = 'default';
    src.bgColor = fondout;
}

function mouseclick(src){
    if (isIE()) {
        wl = event.srcElement.getElementsByTagName('A')[0];
        if (wl != null) 
            window.location = wl;
    }
    if (isNS()) {
        wl = src.target.getElementsByTagName('A')[0];
        if (wl != null) 
            window.location = wl;
    }
    if (isFF()) 
        try {
            wl = src.target.getElementsByTagName('A')[0];
            if (wl != null) 
                window.location = wl;
        } 
        catch (err) {
        }
    if (isOT()) {
        event.target.getElementsByTagName('A')[0].click();
    }
}

self.onError = null;
lastScrollY = 0;
stBeat = 1;

function startBeat(){
    if (isIE()) {
        dotPlay = document.all.hideplay.src;
        dotStop = document.all.hidestop.src;
        if ((document.all.hidestop0.title == "PARAR") ||
        (document.all.hidestop1.title == "PARAR")) {
            stBeat = 0;
            document.all.hidestop0.src = dotPlay;
            document.all.hidestop0.title = "MOVER";
            document.all.hidestop1.src = dotPlay;
            document.all.hidestop1.title = "MOVER";
        }
        else {
            stBeat = 1;
            document.all.hidestop0.src = dotStop;
            document.all.hidestop0.title = "PARAR";
            document.all.hidestop1.src = dotStop;
            document.all.hidestop1.title = "PARAR";
        }
    }
    if (isNS()) {
        dotPlay = document.hideplay.src;
        dotStop = document.hidestop.src;
        if ((document.hidestop0.title == "PARAR") ||
        (document.hidestop1.title == "PARAR")) {
            stBeat = 0;
            document.hidestop0.src = dotPlay;
            document.hidestop0.title = "MOVER";
            document.hidestop1.src = dotPlay;
            document.hidestop1.title = "MOVER";
        }
        else {
            stBeat = 1;
            document.hidestop0.src = dotStop;
            document.hidestop0.title = "PARAR";
            document.hidestop1.src = dotStop;
            document.hidestop1.title = "PARAR";
        }
    }
    if (isFF()) {
        dotPlay = document.getElementById('hideplay').src;
        dotStop = document.getElementById('hidestop').src;
        if ((document.getElementById('hidestop0').title == "PARAR") ||
        (document.getElementById('hidestop1').title == "PARAR")) {
            stBeat = 0;
            document.getElementById('hidestop0').src = dotPlay;
            document.getElementById('hidestop0').title = "MOVER";
            document.getElementById('hidestop1').src = dotPlay;
            document.getElementById('hidestop1').title = "MOVER";
        }
        else {
            stBeat = 1;
            document.getElementById('hidestop0').src = dotStop;
            document.getElementById('hidestop0').title = "PARAR";
            document.getElementById('hidestop1').src = dotStop;
            document.getElementById('hidestop1').title = "PARAR";
        }
    }
}

function heartBeatIE(){
    if (stBeat == 1) {
        diffY = document.body.scrollTop;
        if (diffY != lastScrollY) {
            percent = 0.1 * (diffY - lastScrollY);
            if (percent > 0) 
                percent = Math.ceil(percent);
            else 
                percent = Math.floor(percent);
            if (document.all.hidebt != null) {
                controleInicio = document.all.hidebt.style.pixelTop;
                if (controleInicio < 18) 
                    controleInicio = 18;
                document.all.hidebt.style.pixelTop += percent;
                controleFim = document.all.hidebt.style.pixelTop;
                if (controleFim < 18) 
                    document.all.hidebt.style.pixelTop = controleInicio;
            }
            if (document.all.hidebt.style.visibility != "visible") {
                controleInicio = document.all.superbest.style.pixelTop;
                if (controleInicio < 14) 
                    controleInicio = 14;
                document.all.superbest.style.pixelTop += percent;
                controleFim = document.all.superbest.style.pixelTop;
                if (controleFim < 14) 
                    document.all.superbest.style.pixelTop = controleInicio;
                if (document.all.superads != null) {
                    controleInicio = document.all.superads.style.pixelTop;
                    if (controleInicio < 0) 
                        controleInicio = 0;
                    document.all.superads.style.pixelTop += percent;
                    controleFim = document.all.superads.style.pixelTop;
                    if (controleFim < 0) 
                        document.all.superads.style.pixelTop = controleInicio;
                }
            }
            lastScrollY = lastScrollY + percent;
        }
    }
}

function heartBeatNS(){
    if (stBeat == 1) {
        diffY = self.pageYOffset;
        if (diffY != lastScrollY) {
            percent = 0.1 * (diffY - lastScrollY);
            if (percent > 0) 
                percent = Math.ceil(percent);
            else 
                percent = Math.floor(percent);
            if (document.hidebt != null) {
                controleInicio = document.hidebt.top;
                if (controleInicio < 18) 
                    controleInicio = 18;
                document.hidebt.top += percent;
                controleFim = document.hidebt.top;
                if (controleFim < 18) 
                    document.hidebt.top = controleInicio;
            }
            if (document.hidebt.visibility != "visible") {
                controleInicio = document.superbest.top;
                if (controleInicio < 14) 
                    controleInicio = 14;
                document.superbest.top += percent;
                controleFim = document.superbest.top;
                if (controleFim < 14) 
                    document.superbest.top = controleInicio;
                if (document.superads != null) {
                    controleInicio = document.superads.top;
                    if (controleInicio < 0) 
                        controleInicio = 0;
                    document.superads.top += percent;
                    controleFim = document.superads.top;
                    if (controleFim < 0) 
                        document.superads.top = controleInicio;
                }
            }
            lastScrollY = lastScrollY + percent;
        }
    }
}

function heartBeatFF(){
    if (stBeat == 1) {
        diffY = window.pageYOffset;
        if (diffY != lastScrollY) {
            percent = 0.1 * (diffY - lastScrollY);
            if (percent > 0) 
                percent = Math.ceil(percent);
            else 
                percent = Math.floor(percent);
            if (lastScrollY > 18) {
                try {
                    document.getElementById('hidebt').style.top = +lastScrollY;
                } 
                catch (ex0) {
                }
            }
            if (document.getElementById('hidebt').style.visibility != "visible") {
                if (lastScrollY > 14) {
                    try {
                        document.getElementById('superbest').style.top = +lastScrollY;
                    } 
                    catch (ex1) {
                    }
                }
                try {
                    document.getElementById('superads').style.top = +lastScrollY;
                } 
                catch (ex2) {
                }
            }
            lastScrollY = lastScrollY + percent;
        }
    }
}

function hideClick(sw){
    if (isIE()) {
        var doc_tables = document.all.tags('td');
        if (sw == 0) {
            document.all.superbest.style.visibility = "hidden";
            document.all.superbest.style.pixelTop = 50;
            if (document.all.superads != null) {
                document.all.superads.style.visibility = "hidden";
                document.all.superads.style.pixelTop = 50;
                document.all.superads.style.pixelRight = document.body.clientWidth;
                document.all.toprighttable.style.visibility = "hidden";
                document.all.toprighttable.style.width = 1;
            }
            document.all.toplefttable.style.visibility = "hidden";
            document.all.toplefttable.style.width = 1;
            document.all.hidebt.style.visibility = "visible";
            for (i = 0; i < doc_tables.length; i++) 
                if (doc_tables(i).width == "1%") 
                    doc_tables(i).width = 1;
        }
        else {
            document.all.superbest.style.pixelTop = document.body.scrollTop + 14;
            document.all.superbest.style.visibility = "visible";
            if (document.all.superads != null) {
                document.all.superads.style.pixelTop = document.body.scrollTop;
                document.all.superads.style.pixelRight = 3;
                document.all.superads.style.visibility = "visible";
                document.all.toprighttable.style.visibility = "visible";
                document.all.toprighttable.style.width = 163;
            }
            document.all.toplefttable.style.visibility = "visible";
            document.all.toplefttable.style.width = 105;
            document.all.hidebt.style.visibility = "hidden";
            for (i = 0; i < doc_tables.length; i++) 
                if (doc_tables(i).width == 1) 
                    doc_tables(i).width = "1%";
        }
    }
    if (isNS()) {
        var doc_tables = document.all.tags('td');
        if (sw == 0) {
            document.superbest.visibility = "hidden";
            document.superbest.top = 50;
            if (document.superads != null) {
                document.superads.visibility = "hidden";
                document.superads.top = 50;
                document.superads.right = self.pageWidth;
                document.toprighttable.visibility = "hidden";
                document.toprighttable.width = 1;
            }
            document.toplefttable.visibility = "hidden";
            document.toplefttable.width = 1;
            document.hidebt.visibility = "visible";
            for (i = 0; i < doc_tables.length; i++) 
                if (doc_tables(i).width == "1%") 
                    doc_tables(i).width = 1;
        }
        else {
            document.superbest.top = self.pageYOffset + 14;
            document.superbest.visibility = "visible";
            if (document.superads != null) {
                document.superads.top = self.pageYOffset;
                document.superads.right = 3;
                document.superads.visibility = "visible";
                document.toprighttable.visibility = "visible";
                document.toprighttable.width = 163;
            }
            document.toplefttable.visibility = "visible";
            document.toplefttable.width = 105;
            document.hidebt.visibility = "hidden";
            for (i = 0; i < doc_tables.length; i++) 
                if (doc_tables(i).width == 1) 
                    doc_tables(i).width = "1%";
        }
    }
    if (isFF()) {
        var doc_tables = document.getElementsByTagName('td');
        if (sw == 0) {
            document.getElementById('superbest').style.visibility = "hidden";
            document.getElementById('superbest').style.top = 50;
            try {
                document.getElementById('superads').style.visibility = "hidden";
                document.getElementById('superads').style.top = 50;
                document.getElementById('superads').style.right = window.innerWidth;
                document.getElementById('toprighttable').style.visibility = "hidden";
                document.getElementById('toprighttable').style.width = 1;
            } 
            catch (ex0) {
            }
            document.getElementById('toplefttable').style.visibility = "hidden";
            document.getElementById('toplefttable').style.width = 1;
            document.getElementById('hidebt').style.visibility = "visible";
            for (i = 0; i < doc_tables.length; i++) 
                if (doc_tables[i].width == "1%") 
                    doc_tables[i].width = 1;
        }
        else {
            document.getElementById('superbest').style.top = window.pageYOffset + 14;
            document.getElementById('superbest').style.visibility = "visible";
            try {
                document.getElementById('superads').style.top = window.pageYOffset;
                document.getElementById('superads').style.right = 3;
                document.getElementById('superads').style.visibility = "visible";
                
                document.getElementById('toprighttable').style.visibility = "visible";
                document.getElementById('toprighttable').style.width = 163;
            } 
            catch (ex0) {
            }
            document.getElementById('toplefttable').style.visibility = "visible";
            document.getElementById('toplefttable').style.width = 105;
            document.getElementById('hidebt').style.visibility = "hidden";
            for (i = 0; i < doc_tables.length; i++) 
                if (doc_tables[i].width == 1) 
                    doc_tables[i].width = "1%";
        }
    }
}

function readMode(){
    if (isIE()) {
        dotPlay = document.all.showpics.src;
        dotStop = document.all.hidepics.src;
        if ((document.all.hidepics0.title == "MODO LEITURA") ||
        (document.all.hidepics1.title == "MODO LEITURA")) {
            document.all.hidepics0.src = dotPlay;
            document.all.hidepics0.title = "NÃO LEITURA";
            document.all.hidepics1.src = dotPlay;
            document.all.hidepics1.title = "NÃO LEITURA";
            
            document.body.background = "";
            document.body.style.color = "#000000";
            document.body.style.backgroundColor = "#FFFFFF";
            
            document.body.alink = active;
            document.body.vlink = visited;
            document.body.link = deflink;
        }
        else {
            document.all.hidepics0.src = dotStop;
            document.all.hidepics0.title = "MODO LEITURA";
            document.all.hidepics1.src = dotStop;
            document.all.hidepics1.title = "MODO LEITURA";
            
            document.body.background = document.all.bodypic.src;
            document.body.style.color = document.all.bodytext.style.color;
            document.body.style.backgroundColor = document.all.bodytext.style.backgroundColor;
            
            document.body.alink = document.all.bodytext.alink;
            document.body.vlink = document.all.bodytext.vlink;
            document.body.link = document.all.bodytext.link;
        }
    }
    if (isNS()) {
        dotPlay = document.showpics.src;
        dotStop = document.hidepics.src;
        if ((document.hidepics0.title == "MODO LEITURA") ||
        (document.hidepics1.title == "MODO LEITURA")) {
            document.hidepics0.src = dotPlay;
            document.hidepics0.title = "NÃO LEITURA";
            document.hidepics1.src = dotPlay;
            document.hidepics1.title = "NÃO LEITURA";
        }
        else {
            document.hidepics0.src = dotStop;
            document.hidepics0.title = "MODO LEITURA";
            document.hidepics1.src = dotStop;
            document.hidepics1.title = "MODO LEITURA";
        }
    }
    if (isFF()) {
        dotPlay = document.getElementById('showpics').src;
        dotStop = document.getElementById('hidepics').src;
        if ((document.getElementById('hidepics0').title == "MODO LEITURA") ||
        (document.getElementById('hidepics1').title == "MODO LEITURA")) {
            document.getElementById('hidepics0').src = dotPlay;
            document.getElementById('hidepics0').title = "NÃO LEITURA";
            document.getElementById('hidepics1').src = dotPlay;
            document.getElementById('hidepics1').title = "NÃO LEITURA";
            
            document.getElementById('bodyprop').background = "";
            document.getElementById('bodyprop').style.color = "#000000";
            document.getElementById('bodyprop').style.backgroundColor = "#FFFFFF";
            
            document.getElementById('bodyprop').alink = active;
            document.getElementById('bodyprop').vlink = visited;
            document.getElementById('bodyprop').link = deflink;
        }
        else {
            document.getElementById('hidepics0').src = dotStop;
            document.getElementById('hidepics0').title = "MODO LEITURA";
            document.getElementById('hidepics1').src = dotStop;
            document.getElementById('hidepics1').title = "MODO LEITURA";
            
            document.getElementById('bodyprop').background = document.getElementById('bodypic').src;            
            document.getElementById('bodyprop').style.color = document.getElementById('bodytext').style.color;
            document.getElementById('bodyprop').style.backgroundColor = document.getElementById('bodytext').style.backgroundColor;
            
            document.getElementById('bodyprop').alink = document.getElementById('bodytext').alink;
            document.getElementById('bodyprop').vlink = document.getElementById('bodytext').vlink;
            document.getElementById('bodyprop').link = document.getElementById('bodytext').link;
        }
    }
}

if (isIE()) 
    action = window.setInterval("heartBeatIE()", 1);

if (isNS()) 
    action = window.setInterval("heartBeatNS()", 1);

if (isFF()) 
    action = window.setInterval("heartBeatFF()", 1);
