﻿var popupStatusCom = 0;
function loadPopupCom(){
	if(popupStatusCom==0){
		$("#backgroundPopupCom").css({
			"opacity": "0.7"
		});
		$("#backgroundPopupCom").fadeIn("slow");
		$("#backgroundPopupCom").width($(window).width());
        $("#backgroundPopupCom").height($(document).height());
		$("#popupContactCom").fadeIn("slow");
		popupStatusCom = 1;
	}
}
function disablePopupCom(){
	
	if(popupStatusCom==1){
		$("#backgroundPopupCom").fadeOut("slow");
		$("#popupContactCom").fadeOut("slow");
		popupStatusCom = 0;
	}
}
function centerPopupCom(){
	
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupContactCom").height();
	var popupWidth = $("#popupContactCom").width();
	
	$("#popupContactCom").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	
	
	$("#backgroundPopupCom").css({
		"height": windowHeight
	});
	
}



$(document).ready(function(){

	$("#postAComment").click(function(){

		    centerPopupCom();
	    	loadPopupCom();

	    });
	    
	
    $("#Cancel").click(function(){
		disablePopupCom();

	});
	$("#fBookConnect").click(function(){
		disablePopupCom();

	});
	

	$("#popupContactCloseCom").click(function(){
		disablePopupCom();
		
	});
	
	$("#backgroundPopupCom").click(function(){
		disablePopupCom();
		
	});
	


});