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

//loading popup with jQuery magic!
function loadPopup()
{
	if ( popupStatus == 0 ) 
	{
		$("#backgroundPopup").css({
			"opacity": "0.9"
		})
	
		$("#backgroundPopup").fadeIn("slow");
		$("#popup").fadeIn("slow");
		popupStatus = 1;
	}
}

//disable popup with jQuery magic
function disablePopup()
{
	if ( popupStatus == 1 )
	{
		$("#backgroundPopup").fadeOut("slow");
		$("#popup").fadeOut("slow");
		popupStatus = 0;
	}
}

//centering popup
/* added params so jmorph can load data then pass in the width/height */
function centerPopup()
{
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popup").height();
	var popupWidth = $("#popup").width();
	// centering
	
	$("#popup").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	})
	
	//IE6 force
	$("#backgroundPopup").css({
		"height": windowHeight
	})
}

$(document).ready(function()
{
	//lOADING POPUP
	// centering with css
	centerPopup();
	//loadPopup();
	// CLOSING POP
	$("#popupPhotoClose").click(function(){
		disablePopup();
	})
	
	$("#backgroundPopup").click(function(){
		disablePopup();
	})
})













