﻿var popupStatus = 0;
var popup;
var followerGuid;
var ownerGuid;
//loading popup with jQuery magic!
function loadPopup(popupName) {
    popup = '#' + popupName;
    //loads popup only if it is disabled
    if (popupStatus == 0) {
        $("#backgroundPopup").css({
            "opacity": "0.7"
        });
        $("#backgroundPopup").fadeIn("slow");
        $(popup).fadeIn("slow");
        $("#MainContent").fadeOut("slow");
        popupStatus = 1;
    }
}

//disabling popup with jQuery magic!
function disablePopup() {
    //disables popup only if it is enabled
    if (popupStatus == 1) {
        $("#backgroundPopup").fadeOut("slow");
        $(popup).fadeOut("slow");
        $("#MainContent").fadeIn("slow");
        popupStatus = 0;
    }
}
//centering popup
function centerPopup(popupName) {
    //request data for centering
    popup = '#' + popupName;
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popMargTop = ($(popup).height() + 50) / 2;
    var popMargLeft = ($(popup).width() + 50) / 2;
    //centering
    $(popup).css({
        'margin-top': -popMargTop,
        'margin-left': -popMargLeft
    });
    //only need force for IE6

    $("#backgroundPopup").css({
        "height": windowHeight
    });
}


//CONTROLLING EVENTS IN jQuery
$(document).ready(function () {

    //CLOSING POPUP
    //Click the x event!
    $("#popupClose").click(function () {
        disablePopup();
    });

});

