﻿var popupQuotesStatus = 0;


function loadPopupQuotes() {
    if (popupQuotesStatus == 0) {
        $("popupQuotesBackground").setStyle("opacity", "0.7");
        $("popupQuotesContainer").setStyle("display", "block");
        $("popupQuotesBackground").setStyle("display", "block");
        popupQuotesStatus = 1;
    }
}

function disablePopupQuotes() {
    document.getElementById("popupQuotesContainer").style.display = 'none';
    document.getElementById("popupQuotesBackground").style.display = 'none';
    popupQuotesStatus = 0;
}

function centerPopupQuotes() {
    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 = $("popupQuotesContainer").getStyle("height").toInt();
    var popupWidth = $("popupQuotesContainer").getStyle("width").toInt();
    if (popupHeight == 0) popupHeight = 600;
    if (popupWidth == 0) popupWidth = 460;

    $("popupQuotesContainer").setStyle("position", "absolute");
    $("popupQuotesContainer").setStyle("top", (rootObject.scrollTop + ((windowHeight / 2) - (popupHeight / 2) + 10)) + "px");
    $("popupQuotesContainer").setStyle("left", ((vpWidth / 2) - (popupWidth / 2) -20) + "px");
    //only need force for IE6
    $("popupQuotesBackground").setStyle("height", windowHeight);
}