
function resize(){
    if (window.innerWidth == undefined) {
        startX = document.body.clientWidth - (((document.body.clientWidth - 760) / 2) + 111);
    } else {
        startX = window.innerWidth - (((window.innerWidth - 760) / 2) + 111);
    }

    startY = 0;
}

window.onresize=JSFX_FloatTopDiv;

var incY=0;
var verticalpos="frombottom"
var incrY;
incrY = 0;

var divs, contDivs, maxHeight, divHeight, d;

function JSFX_FloatTopDiv() {

//    if (window.fullScreen = true) {
//        alert("window.fullScreen: " + window.fullScreen);
    //    }
    
    contDivs = [];
    
    divs = document.getElementsByTagName('div');

    for (var i = 0; i < divs.length; i++) 
    {

        d = divs[i];
        if (d.id == 'divFlutuante') 
        {
            contDivs[contDivs.length] = d;
            maxHeight = contDivs[0].style.height;
            //maxHeight = d.style.height;
            divHeight = d.offsetHeight+10+"px";
            //alert("divHeight: " + divHeight);
            //alert("maxHeight:" + maxHeight);
        }

    }
   
    //if (window.maximized = true) {
    //alert("top.window.outerHeight: " + window.outerHeight);
    //alert("screen.availHeight: " + screen.availHeight);
    //alert("top.window.outerWidth: " + window.outerWidth);
    //alert("screen.availWidth: " + screen.availWidth);
    //alert("document.body.clientWidth: " + document.body.clientWidth);
    //alert("document.body.clientHeight: " + document.body.clientHeight);
    
        docHeight = document.documentElement.clientHeight+"px"
        //alert("docHeight: " + docHeight);
        resize();

        var startX = 0, startY = 0;

        var ns = (navigator.appName.indexOf("Netscape") != -1);
        var d = document;
        var px = document.layers ? "" : "px";
        function ml(id) {
            var el = d.getElementById ? d.getElementById(id) : d.all ? d.all[id] : d.layers[id];
            if (d.layers) el.style = el;
            el.sP = function(x, y) { this.style.left = x + px; this.style.top = y + px; };
            el.x = startX;
            if (verticalpos == "fromtop") {
                el.y = startY;
            }
            else {
                el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
                el.y -= startY;
            }
            return el;

        }
        window.stayTopLeft = function() {

        if (docHeight > divHeight) {
                var pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
                ftlObj.y += (pY + startY - ftlObj.y - 460) / 8; //230

                if (ftlObj.y < startY) {
                    ftlObj.y = 0;
                }

                ftlObj.sP(ftlObj.x, ftlObj.y);

                setTimeout("stayTopLeft()", 10);
            }
            else {
                ftlObj.y = 0;
                ftlObj.sP(ftlObj.x, ftlObj.y);

                setTimeout("stayTopLeft()", 10);
            }

        }
        
            ftlObj = ml("divFlutuante");
          
        stayTopLeft();
    //}
    
}
JSFX_FloatTopDiv();


