
var Hoffset = 0 //Coordenada X a partir da direita da tela
var Voffset = 0 //Coordenada Y a partir do topo da página
var thespeed = 3 //Velocidade (Advised: 1-3)

var ieNOTopera = document.all && navigator.userAgent.indexOf("Opera") == -1
var myspeed = 0

var ieHoffset_extra = document.all ? 15 : 0
//var cross_obj = document.all ? document.all.staticbuttons : document.getElementById ? document.getElementById("staticbuttons") : document.staticbuttons

var cross_obj = document.getElementById("staticbuttons");


function iecompattest() {
    return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body
}

function positionit() {

    var dsocleft = document.all ? iecompattest().scrollLeft : pageXOffset
    var dsoctop = document.all ? iecompattest().scrollTop : pageYOffset
    var window_width = ieNOTopera ? iecompattest().clientWidth + ieHoffset_extra : window.innerWidth + ieHoffset_extra
    var window_height = ieNOTopera ? iecompattest().clientHeight : window.innerHeight

    if (document.all || document.getElementById) {
        if (document.getElementById("staticbuttons")) {
            document.getElementById("staticbuttons").style.right = Hoffset + "px"
            document.getElementById("staticbuttons").style.top = dsoctop + Voffset + "px"
        }
       
    }
    else if (document.layers) {
        cross_obj.left = dsocleft + window_width - Hoffset
        cross_obj.top = dsoctop + window_height - Voffset
    }
}

function scrollwindow() {
    window.scrollBy(0, myspeed)
}

function initializeIT() {
    positionit()
    if (myspeed != 0) {
        scrollwindow()
    }
}

if (document.all || document.getElementById || document.layers) {
    setInterval("initializeIT()", 1)
}

function banner() {

    document.getElementById("staticbuttons").style.display = "none"
}

function escrevebanner() {
    if (screen.width > 800 && screen.height > 600) {
    
        document.write('<div id="staticbuttons" style="position:absolute; left:790px; margin-top:10px; z-index:1;">');
        document.write(document.getElementById("bannerFloat").innerHTML);
        document.write('</div>');
        document.write("<scr" + "ipt src='/js/bannerflutuante.js' type='text/javascript'><\/scr" + "ipt>");
    }
}

