function ShowPopup(id) { //to center
//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();
var scrollTop = $(window).scrollTop();
//Set height and width to mask to fill up the whole screen
$('#mask').css({ 'width': maskWidth, 'height': maskHeight });
//transition effect
$('#mask').fadeIn(0);
$('#mask').fadeTo("slow", 0.3);
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
//Set the popup window to center
var p = $(id).css("padding");
var nP = p.substr(0, p.indexOf("px"));
var docH = $(id).height() nP * 2;
var docW = $(id).width() nP * 2;
$(id).css('top', scrollTop (winH / 2 - docH / 2));
$(id).css('left', winW / 2 - docW / 2);
//transition effect
$(id).fadeIn(0);
return id;
}