﻿/*var popupStatus = 0;

function loadPopup() {
    if (popupStatus == 0) {
        $("popupBackground").setStyle("opacity", "0.7");
        $("popupContainer").setStyle("display", "block");
        $("popupBackground").setStyle("display", "block");
        popupStatus = 1;
    }
}

function disablePopup() {
    document.getElementById("popupContainer").style.display = 'none';
    document.getElementById("popupBackground").style.display = 'none';
    popupStatus = 0;
}

function centerPopup() {
    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 = $("popupContainer").getStyle("height").toInt();
    var popupWidth = $("popupContainer").getStyle("width").toInt();
    if (popupHeight == 0) popupHeight = 600;
    if (popupWidth == 0) popupWidth = 600;

    $("popupContainer").setStyle("position", "absolute");
    $("popupContainer").setStyle("top", (rootObject.scrollTop + ((windowHeight / 2) - (popupHeight / 2) - 50)) + "px");
    $("popupContainer").setStyle("left", ((vpWidth / 2) - (popupWidth / 2) - 100) + "px");
    //only need force for IE6
    $("popupBackground").setStyle("height", windowHeight);
}*/


var popupStatus = 0;

function loadPopup() {
    if (popupStatus == 0) {
        $("#popupBackground").css("opacity", "0.7");
        $("#popupContainer").css("display", "block");
        $("#popupBackground").css("display", "block");
        popupStatus = 1;
    }
}

function disablePopup() {
    document.getElementById("popupContainer").style.display = 'none';
    document.getElementById("popupBackground").style.display = 'none';
    popupStatus = 0;
}

function centerPopup() {
    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($("#popupContainer").css("height")); //$("popupContainer").getStyle("height").toInt();
    var popupWidth = parseInt($("#popupContainer").css("width"));

    if (isNaN(popupHeight)) {
        popupHeight = 600;
    }
    if (isNaN(popupWidth)) {
        popupWidth = 460;
    } 
    
//    if (popupHeight == 0) popupHeight = 600;
//    if (popupWidth == 0) popupWidth = 600;

    $("#popupContainer").css("position", "absolute");
    $("#popupContainer").css("top", (rootObject.scrollTop + ((windowHeight / 2) - (popupHeight / 2) - 50)) + "px");
    $("#popupContainer").css("left", ((vpWidth / 2) - (popupWidth / 2) - 100) + "px");
    //only need force for IE6
    $("#popupBackground").css("height", windowHeight);
}