﻿var idBox = 'former';

function BoxShow() {
	
    box = document.getElementById(idBox);
		
    BoxHide(idBox);

    box.style.display = 'block';
    box.style.position = 'absolute';
	
	
	var screenW = 640, screenH = 480;
    if (parseInt(navigator.appVersion) > 3) {
        screenW = screen.width;
        screenH = screen.height;
    }
    else if (navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 3 && navigator.javaEnabled()) {
        var jToolkit = java.awt.Toolkit.getDefaultToolkit();
        var jScreenSize = jToolkit.getScreenSize();
        screenW = jScreenSize.width;
        screenH = jScreenSize.height;
    }
    box.style.right = (pageWidth() + getScrollXY()[0] - box.offsetWidth) / 2 + "px";
    box.style.top = (pageHeight() + getScrollXY()[1] - box.offsetHeight) / 2 + "px";
    return;
}




function BoxHide() {
	box = document.getElementById(idBox);
    box.style.display = 'none';
    return;
}


function getScrollXY() {
    var scrOfX = 0, scrOfY = 0;
    if (typeof (window.pageYOffset) == 'number') {
        //Netscape compliant
        scrOfY = window.pageYOffset;
        scrOfX = window.pageXOffset;
    } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
        //DOM compliant
        scrOfY = document.body.scrollTop;
        scrOfX = document.body.scrollLeft;
    } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
        //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
    }
    return [scrOfX, scrOfY];
}


function pageWidth() {
    return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}
function pageHeight() {
    return window.innerHeight != null ? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null ? document.body.clientHeight : null;
}

BoxHide();
