﻿var popupStatusComfb = 0;
function loadPopupComfb() {
    if (popupStatusComfb == 0) {
        $("#backgroundPopupfb").css({
            "opacity": "0.9"
        });
        $("#backgroundPopupfb").width($(window).width());
        $("#backgroundPopupfb").height($(document).height());
        $("#backgroundPopupfb").fadeIn("slow");
        $("#simplemodal-containerfb").fadeIn("slow");
        popupStatusComfb = 1;
    }
}
function disablePopupComfb() {

    if (popupStatusComfb == 1) {
        $("#backgroundPopupfb").fadeOut("slow");
        $("#simplemodal-containerfb").fadeOut("slow");
        popupStatusComfb = 0;
    }
}
function centerPopupComfb() {

    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupHeight = $("#simplemodal-containerfb").height();
    var popupWidth = $("#simplemodal-containerfb").width();

    $("#simplemodal-containerfb").css({
        "z-index":20000,
        "position": "absolute",
        "top": windowHeight / 2 - popupHeight / 2,
        "left": windowWidth / 2 - popupWidth / 2
    });


    $("#backgroundPopupfb").css({
        "height": windowHeight
    });

}



$(document).ready(function() {
    $("#ShowLogin").click(function() {

        centerPopupComfb();
        loadPopupComfb();

    });

    $("#fbCon img").click(function(){
        disablePopupComfb();
    });

    $("#Cancel").click(function() {
        disablePopupComfb();

    });
    $("#fBookConnect").click(function() {
        disablePopupComfb();

    });


    $("#popupContactCloseCom").click(function() {
        disablePopupComfb();

    });

    $("#backgroundPopupfb").click(function() {
        disablePopupComfb();

    });



});