var popupStatus = 0;
function OnMoreInfoClick(element, key)
{
  loadPopup(key);
  centerPopup(key);
}

function OnCloseClick(element, key)
{

  disablePopup(key);
}

function loadPopup(myobject){
	if(popupStatus==0){
		$(myobject).fadeIn("slow");
		popupStatus = 1;
	}
}

function disablePopup(myobject){

	if(popupStatus==1){
		$(myobject).fadeOut("slow");
		popupStatus = 0;
	}
}

function centerPopup(myobject){
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight; 
	var popupHeight = $(myobject).height();
	var popupWidth = $(myobject).width();
	$(myobject).css({
		/* "position": "relative", */
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
}

