//Instellen popup
//0 betekend inactief; 1 betekend actief;
var popupStatus = 0;

// Popup openen
function openPopup(){
	// Popup openen, alleen wanneer deze inactief is
	if(popupStatus==0){
		$("#backgroundlaborpopup").css({
			"opacity": "0.4"
		});
		$("#backgroundlaborpopup").fadeIn("slow");
		$("#laborpopup").fadeIn("slow");
		popupStatus = 1;
	}
}

// Popup sluiten
function closePopup(){
	// Popup sluiten, alleen wanneer deze actief is
	if(popupStatus==1){
		$("#backgroundlaborpopup").fadeOut("slow");
		$("#laborpopup").fadeOut("slow");
		popupStatus = 0;
	}
}

// Events definieren
$(document).ready(function(){
	
	// Openen popup
	$("#laborpopupbutton").click(function(){
		openPopup();
	});
				
	// Sluiten popup
	// Button event - sluiten popup
	$("#popuplaborClose").click(function(){
		closePopup();
	});	
	// Achtergrond klikken - sluiten popup
	$("#backgroundlaborpopup").click(function(){
		closePopup();
	});
	// Escape event - sluiten popup
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			closePopup();
		}
	});

});
