var popupStatus = 0;
function loadPopup_1(){
	if(popupStatus==0){
		$("#backgroundPopup_1").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup_1").fadeIn("slow");
		$("#popupContact_1").fadeIn("slow");
		popupStatus = 1;
	}
}
function disablePopup_1(){
	if(popupStatus==1){
		$("#backgroundPopup_1").fadeOut("slow");
		$("#popupContact_1").fadeOut("slow");
		popupStatus = 0;
	}
}
function centerPopup_1(){
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupContact_1").height();
	var popupWidth = $("#popupContact_1").width();
	$("#popupContact_1").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	$("#backgroundPopup_1").css({
		"height": windowHeight
	});
	
}
$(document).ready(function(){
	$("#button_1").click(function(){
		centerPopup_1();
		loadPopup_1();
	});
	$("#popupContactClose_1").click(function(){
		disablePopup_1();
	});
	$("#backgroundPopup_1").click(function(){
		disablePopup_1();
	});
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			disablePopup_1();
		}
	});
});

