﻿var popupStatus = 0;

function loadPopupPerson() {
    if (popupStatus == 0) {
        $("#popupPersonBackground").css("opacity", "0.7");
        $("#popupPersonContainer").css("display", "block");
        $("#popupPersonBackground").css("display", "block");
        popupStatus = 1;
    }
}

function disablePopupPerson() {
    document.getElementById("popupPersonContainer").style.display = 'none';
    document.getElementById("popupPersonBackground").style.display = 'none';
    popupStatus = 0;
}

function centerPopupPerson() {
    var rootObject = (document.documentElement && document.compatMode == 'CSS1Compat') ? document.documentElement : document.body;
    var vpWidth = self.innerWidth ? self.innerWidth : rootObject.clientWidth; // viewport width
    var vpHeight = self.innerHeight ? self.innerHeight : rootObject.clientHeight; // viewport height 

    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;

    var popupHeight = parseInt($("#popupPersonContainer").css("height"));
    var popupWidth = parseInt($("#popupPersonContainer").css("width"));

    if (isNaN(popupHeight)) {
        popupHeight = 600;
    }
    if (isNaN(popupWidth)) {
        popupWidth = 460;
    } 

    $("#popupPersonContainer").css("position", "absolute");
    $("#popupPersonContainer").css("top", rootObject.scrollTop + 20 + "px");
    $("#popupPersonContainer").css("left", ((vpWidth / 2) - (popupWidth / 2)) - (vpWidth / 35) + "px");
    //only need force for IE6
    $("#popupPersonBackground").css("height", windowHeight);
}