
jQuery.fn.center = function () {
    return this.each(function() {
	var top = ($(window).height() - $(this).height()) / 2 + 30;
	var left = ($(window).width() - $(this).width()) / 2;
	$(this).css({
	    position:'absolute',
	    margin:0,
	    top: (top > 0 ? top : 0)+'px',
	    left: (left > 0 ? left : 0)+'px'
	});
    });
}

function showPopup(id) {    
    if ($.browser.msie) {
	overlay.css('filter', 'alpha(opacity=75)');
    }
    overlay.fadeIn('fast');
    $("#" + id).fadeIn('fast');
    $("#" + id).center();
    return true;
}

function closePopup() {
    var popupsDiv = $("#popups");
    overlay.fadeOut('fast');
    $("> div", popupsDiv).fadeOut('fast');
}


