﻿var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup() {
    //loads popup only if it is disabled
    if (popupStatus == 0) {
        $("#backgroundPopup").css({
            "opacity": "0.7"
        });
        $("#backgroundPopup").fadeIn("slow");
        $("#popupContact").fadeIn("slow");
        popupStatus = 1;
    }
}


//disabling popup with jQuery magic!
function disablePopup() {
    //disables popup only if it is enabled
    if (popupStatus == 1) {
        $("#backgroundPopup").fadeOut("slow");
        $("#popupContact").fadeOut("slow");
        popupStatus = 0;
    }
}


//centering popup
function centerPopup() {
    //request data for centering
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupHeight = $("#popupContact").height();
    var popupWidth = $("#popupContact").width();
    //centering
    $("#popupContact").css({
        "position": "fixed",        
        "top": windowHeight / 2 - popupHeight / 2,
        "left": windowWidth / 2 - popupWidth / 2
    });
    //only need force for IE6

    $("#backgroundPopup").css({
        "height": windowHeight
    });

}

/*--------------------------*/
/*--------------------------*/
/*----POP WITHIN POPUP------*/
/*--------------------------*/
/*--------------------------*/

var popupStatus2 = 0;

//loading popup with jQuery magic!
function loadPopup2() {
    //loads popup only if it is disabled
    if (popupStatus2 == 0) {
        $("#backgroundPopup2").css({
            "opacity": "0.7"
        });
        $("#backgroundPopup2").fadeIn("slow");
        $("#popupContact2").fadeIn("slow");
        popupStatus2 = 1;
    }
}


//disabling popup with jQuery magic!
function disablePopup2() {
    //disables popup only if it is enabled
    if (popupStatus2 == 1) {
        $("#backgroundPopup2").fadeOut("slow");
        $("#popupContact2").fadeOut("slow");
        popupStatus2 = 0;
    }
}


//centering popup
function centerPopup2() {
    //request data for centering
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupHeight = $("#popupContact2").height();
    var popupWidth = $("#popupContact2").width();
    //centering
    $("#popupContact2").css({
        "position": "fixed",        
        "top": windowHeight / 2 - popupHeight / 2,
        "left": windowWidth / 2 - popupWidth / 2
    });
    //only need force for IE6

    $("#backgroundPopup2").css({
        "height": windowHeight
    });

}

/*--------------------------------------*/
/*--------------------------------------*/
/*----FOR THIRD POP in Profile.aspx-----*/
/*--------------------------------------*/
/*--------------------------------------*/

var popupStatus3 = 0;

//loading popup with jQuery magic!
function loadPopup3() {
    //loads popup only if it is disabled
    if (popupStatus3 == 0) {
        $("#backgroundPopup3").css({
            "opacity": "0.7"
        });
        $("#backgroundPopup3").fadeIn("slow");
        $("#popupContact3").fadeIn("slow");
        popupStatus3 = 1;
    }
}


//disabling popup with jQuery magic!
function disablePopup3() {
    //disables popup only if it is enabled
    if (popupStatus3 == 1) {
        $("#backgroundPopup3").fadeOut("slow");
        $("#popupContact3").fadeOut("slow");
        popupStatus3 = 0;
    }
}


//centering popup
function centerPopup3() {
    //request data for centering
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupHeight = $("#popupContact3").height();
    var popupWidth = $("#popupContact3").width();
    //centering
    $("#popupContact3").css({
        "position": "fixed",
        "top": windowHeight / 2 - popupHeight / 2,
        "left": windowWidth / 2 - popupWidth / 2
    });
    //only need force for IE6

    $("#backgroundPopup3").css({
        "height": windowHeight
    });

}

/*--------------------------*/
/*--------------------------*/
/*----POP WITHIN MASTER------*/
/*--------------------------*/
/*--------------------------*/

var popupStatusM = 0;

//loading popup with jQuery magic!
function loadPopupM() {
    //loads popup only if it is disabled
    if (popupStatusM == 0) {
        $("#backgroundPopupM").css({
            "opacity": "0.7"
        });
        $("#backgroundPopupM").fadeIn("slow");
        $("#popupContactM").fadeIn("slow");
        popupStatusM = 1;
    }
}


//disabling popup with jQuery magic!
function disablePopupM() {
    //disables popup only if it is enabled
    if (popupStatusM == 1) {
        $("#backgroundPopupM").fadeOut("slow");
        $("#popupContactM").fadeOut("slow");
        popupStatusM = 0;
    }
}


//centering popup
function centerPopupM() {
    //request data for centering
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupHeight = $("#popupContactM").height();
    var popupWidth = $("#popupContactM").width();
    //centering
    $("#popupContactM").css({
        "position": "fixed",
        "top": windowHeight / 2 - popupHeight / 2,
        "left": windowWidth / 2 - popupWidth / 2
    });
    //only need force for IE6

    $("#backgroundPopupM").css({
        "height": windowHeight
    });

}

