x_banner = 330;
y_banner = 60;
function setVisible(obj){
    var id=obj;
    obj = document.getElementById(obj);
    if(obj){
        obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
        try{ window.onscroll = setTimeout("placeIt('"+id+"')",500); }catch(e){}
    }
}

function placeIt(obj){
    var id=obj;
    obj = document.getElementById(obj);
    if (document.documentElement){
        theLeft = document.documentElement.scrollLeft;
        theTop = document.documentElement.scrollTop;
    }
    else if (document.body){
        theLeft = document.body.scrollLeft;
        theTop = document.body.scrollTop;
    }
    theLeft += x_banner;
    theTop += y_banner;
    
    obj.style.left = theLeft + 'px' ;
    obj.style.top = theTop + 'px' ;
    setTimeout("placeIt('"+id+"')",500);
}
function updateSideBanner(current){    
    if(current <=1){
        showBannerLateral();
    }else{
        hideBannerLateral();
    }
}

function hideBannerLateral(){    
    if(esconderForaDaCapa == 'true'){
        document.getElementById('banner_lateral').style.display='none';
    }
}

function showBannerLateral(){
    var obj = document.getElementById('banner_lateral');
    if(obj){
        var theLeft=window.document.body.clientWidth;
        var theTop =window.document.body.clientHeight;        
        theTop = 80;
        theLeft = (theLeft)-maxwidth;
        theLeft = theLeft-paddingbanner;
        theTop = theTop+paddingbannertop;
        obj.style.left = theLeft+'px';
        obj.style.top = theTop+'px';
        var as = obj.getElementsByTagName('img');
        if(as && as != null){
        if(as.length>1){
            for(var i=0;i<as.length;i++){
                as[i].style.maxWidth=(maxwidth-2)+"px";
            }
        }else{            
            try{as.style.maxWidth=(maxwidth-2)+"px"; }catch(e){}
        }
        }

        document.getElementById('banner_lateral').style.display='block';
    }
}
