var cover = mydiv = null;
window.onload = function() {
    cover = document.getElementById('coverdiv');
    cover.style.width = Math.max(document.documentElement.scrollWidth, document.documentElement.clientWidth) + "px";
    cover.style.height = Math.max(document.documentElement.scrollHeight, document.documentElement.clientHeight) + "px"
    cover.style.display = "none";

    mydiv = document.getElementById('mydiv');
    with (mydiv) {
        // style.width = document.documentElement.scrollWidth / 2 + "px";
        //style.height = document.documentElement.scrollHeight / 2 + "px";
        style.width = "650px";
        style.height = "400px";
        style.left = (document.documentElement.scrollWidth - mydiv.offsetWidth) / 2 + "px";
        style.top = (document.documentElement.scrollHeight - mydiv.offsetHeight) / 2 + "px";
        style.display = "none";
    }
};

function popit(WebPath, KeyID, titlestr) {
    parent.document.getElementById('title').innerText = titlestr;
    document.getElementById('mailBox').src = WebPath + KeyID;
    mydiv.style.display = cover.style.display = '';   
}

