//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;

//Load the popup division
function loadPopup(popup_id,background_id) {
	//Loads popup only if it is disabled
	if (popupStatus == 0) {
		$(background_id).css( {
			"opacity" :"0.7"
		});
		$(background_id).fadeIn("slow");
		$(popup_id).fadeIn("slow");
		popupStatus = 1;
	}
}

//Disable the popup division
function disablePopup(popup_id,background_id) {
	if (popupStatus == 1) {
		$(background_id).fadeOut("slow");
		$(popup_id).fadeOut("slow");
		popupStatus = 0;
	}
}

// Center the popup division
function centerPopup(popup_id) {
	//Get data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $(popup_id).height();
	var popupWidth = $(popup_id).width();
	
	//Center the division
	$(popup_id).css( {
		"position" :"absolute",
		"top" :windowHeight / 2 - popupHeight / 2,
		"left" :windowWidth / 2 - popupWidth / 2
	});
	
	//Set up the background division
	// only need force for IE6
	$("#backgroundDiv").css( {
		"height" :windowHeight
	});			
}