﻿function showcenterdivAlert(Xwidth, Yheight, divid) {

        // First, determine how much the visitor has scrolled 
        //alert(divid.id)
        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 bws = getBrowserHeight();

        var centerX, centerY;
        centerX = bws.width;
        centerY = bws.height;
        //alert(centerY+','+scrolledY)
        // 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 leftoffset = (centerX + scrolledX) / 2 - (Xwidth / 2);
        //var topoffset = scrolledY + (centerY - Yheight) / 2;
        var topoffset = scrolledY + ((centerY) / 2 - (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 = divid;
        var r;

        if (o.style) {
            r = o.style;
        }
        else {
            r = document.getElementById(o).style;
        }

        r.top = (topoffset - 70) + 'px'; 
        r.left = leftoffset + 'px';
        //if (window.navigator.userAgent.indexOf("Firefox") <= -1)
        //    r.top = (centerY  )+ 'px'; 
        //setLayerPosition(divid);
    }
    //-->

    function getBrowserHeight() {
        var intH = 0;
        var intW = 0;

        if (typeof window.innerWidth == 'number') {
            intH = window.innerHeight;
            intW = window.innerWidth;
        }
        else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
            intH = document.documentElement.clientHeight;
            intW = document.documentElement.clientWidth;
        }
        else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
            intH = document.body.clientHeight;
            intW = document.body.clientWidth;
        }

        return { width: parseInt(intW), height: parseInt(intH) };
    } 
var clearAbout;

function ShowAbout() {
    showcenterdivAlert('280', '175', 'divAbout');
    document.getElementById('dvBackOpacityDiv').style.width = (document.body.clientWidth - 1) + 'px';
    document.getElementById('dvBackOpacityDiv').style.height = (document.body.clientHeight) + 'px';

    document.getElementById('dvBackOpacityDiv').style.visibility = "visible";
    document.getElementById('divAbout').style.visibility = "visible";
    
     SendBookMail();

}

function HideAbout()
{
	//clearAbout=setTimeout("HideDivAbout()",1500);
	HideDivAbout();
}

function ClearTimeAbout() {
    document.getElementById('dvBackOpacityDiv').style.visibility = "visible";
	document.getElementById('divAbout').style.visibility="visible";
	clearTimeout(clearAbout);	
}

function HideDivAbout() {
    document.getElementById('dvBackOpacityDiv').style.visibility = "hidden";
	document.getElementById('divAbout').style.visibility="hidden";
}
