var vsCurrentPopupID = '';

jQuery.fn.center = function () {
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}

function CenterPopup(element)
{
	// Start the ticker
	$(function(){
		$(element).center();
	});
}

function ShowPopup(vsID)
{
	// Hide the current one if there is one showing
	if (vsCurrentPopupID != '')
	{
		HidePopup(vsCurrentPopupID);
	}
	
	var element = $('#' + vsID);
	CenterPopup(element);
	$(element).css("visibility", "visible");
	
	// Set the current
	vsCurrentPopupID = vsID;
}

function HidePopup(vsID)
{
	var element = $('#' + vsID);
	$(element).css("visibility", "hidden");
}