﻿var popupQuotesStatus = 0;


function loadPopupQuotes() {
    if (popupQuotesStatus == 0) {
        
        $("#popupQuotesBackground").css("opacity", "0.7");
        $("#popupQuotesContainer").css("display", "block");
        $("#popupQuotesBackground").css("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 = parseInt($("#popupQuotesContainer").css("height"));
    var popupWidth = parseInt($("#popupQuotesContainer").css("width"));
    
    if (isNaN(popupHeight)) {
        popupHeight = 600;
    }
    if (isNaN(popupWidth)) {
        popupWidth = 460;
    }  
    
    $("#popupQuotesContainer").css("position", "absolute");
    $("#popupQuotesContainer").css("top", (rootObject.scrollTop + ((windowHeight / 2) - (popupHeight / 2) + 10)) + "px");
    $("#popupQuotesContainer").css("left", ((vpWidth / 2) - (popupWidth / 2) - 20) + "px");
    //only need force for IE6
    $("#popupQuotesBackground").css("height", windowHeight);


}