﻿
    var popupStatus = 0;
    
    //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;
        }

    }

    function loadPopup(text) {
        //loads popup only if it is disabled
        if (popupStatus == 0) {
            $("#backgroundPopup").css({
                "opacity": "0.7"
            });
            $("#contactArea").html(text);
            $("#backgroundPopup").fadeIn("slow");
            $("#popupContact").fadeIn("slow");
            popupStatus = 1;
        }
       }

       function ShowloadMessage() {
       	//loads popup only if it is disabled       
       		$("#backgroundPopup").css({
       			"opacity": "0.7"
       		});
       		var top = document.documentElement.clientHeight / 3 + 'px';
       		var left = document.body.offsetWidth / 2.5 + 'px';
       		$("#backgroundPopup").fadeIn("slow");
       		$("#loadMsg").fadeIn("slow");
       		$("#loadMsg").css("top", top);
       		$("#loadMsg").css("left", left);
       	
       
       }
    //centering popup
    function centerPopup(popupdevideValue) {
        //request data for centering
        var windowWidth = document.documentElement.scrollWidth;
        var windowHeight = document.documentElement.scrollHeight;
        var popupHeight = $("#popupContact").height();
        var popupWidth = $("#popupContact").width();
        //centering
        $("#popupContact").css({
            "position": "absolute",
            "top": windowHeight / popupdevideValue - popupHeight / popupdevideValue,
            "left": windowWidth / 2 - popupWidth / 2
        });
        //only need force for IE6

        $("#backgroundPopup").css({
            "height": windowHeight
        });

    }


