function Popup()
{};


Popup.prototype.center = function( id, options )
{
	if ( options.left == undefined )
		var popupX = $(document).scrollLeft() + Math.round( ($(window).width() - $('#' + id).width()) / 2 );
	else
		var popupX = options.left;
	
	if ( popupX < 0 )
		popupX = 0;
	
	if ( options.top == undefined )
	{
		var popupY = $(document).scrollTop() + Math.round( ($(window).height() - $('#' + id).height()) / 2 );
		popupY -= 200;
	}
	else
		var popupY = options.top;
	
	if ( popupY < 0 )
		popupY = 0;
	
	$('#' + id).css({ top: popupY + 'px', left: popupX + 'px' });
};


Popup.prototype.show = function( id, options )
{
	if ( options == undefined )
		options = {};
	
	this.center( id, options );
	$('#' + id).css( 'display', '' );
};


Popup.prototype.hide = function( id )
{
	$('#' + id).css( 'display', 'none' );
};


var obPopup = new Popup();
