﻿function showdeadcenterdiv(Xwidth, Yheight, divid,pagename) {
    // First, determine how much the visitor has scrolled 

    var scrolledX, scrolledY;
    if (self.pageYoffset) {
        scrolledX = self.pageXoffset;
        scrolledY = self.pageYoffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {
        scrolledX = document.documentElement.scrollLeft;
        scrolledY = document.documentElement.scrollTop;
    } else if (document.body) {
        scrolledX = document.body.scrollLeft;
        scrolledY = document.body.scrollTop;
    }

    // Next, determine the coordinates of the center of browser's window 

    var centerX, centerY;
    if (self.innerHeight) {
        centerX = self.innerWidth;
        centerY = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {
        centerX = document.documentElement.clientWidth;
        centerY = document.documentElement.clientHeight;
    } else if (document.body) {
        centerX = document.body.clientWidth;
        centerY = document.body.clientHeight;
    }
    // Xwidth is the width of the div, Yheight is the height of the 
    // div passed as arguments to the function: 
    var leftoffset = scrolledX + (centerX - Xwidth) / 2;
    var topoffset = scrolledY + (centerY - Yheight) / 2;
    // The initial width and height of the div can be set in the 
    // style sheet with display:none; divid is passed as an argument to // the function 
    var o = document.getElementById(divid);
    var r = o.style;
    r.position = 'absolute';
    //r.top = topoffset + 'px';
    if (pagename == 'bbb-privacynotice.aspx') {
        document.documentElement.scrollTop = 0;
        r.top = 155 + 'px';
    }
    else {
        r.top = 455 + 'px';
    }
    r.left = leftoffset + 'px';
    r.width = Xwidth + 'px';
    r.height = Yheight + 'px';
    r.display = "block";    
}
function showpopup(Xwidth, Yheight, divid, pagename, popuptitle) {    
    showdeadcenterdiv(Xwidth, Yheight, divid,pagename);
    document.getElementById("modalBody").innerHTML = '';        
    document.getElementById("modalBody").innerHTML = '<iframe src="http://' + location.host + '/' + pagename + '" scrolling="yes" frameborder="0" width=' + Xwidth + ' height=' + (Yheight - 32) + ' marginheight="0" marginwidth="0" vspace="0" hspace="0" style="valign=top"></iframe>';
    document.getElementById("popuptitle").innerHTML = popuptitle;
    //alert(Xwidth - 18);
    document.getElementById('toolbar_divul').style.width = (Xwidth - 20) + 'px';
    return false;
}
function hidepopup() 
{
    document.getElementById("modalBody").innerHTML = '';
    //document.getElementById("preview_div").style.visibility = "hidden";
    document.getElementById("preview_div").style.display = "none";
}