function popup(html)
{
 $("[id=popup]").remove();
 $("[id=bgfade]").remove();
 $("body").prepend("<div id='bgfade' style='background-color: #000; position: absolute; top: 0px; left: 0px; z-index: 1000; display: none;'>&nbsp;</div>");
 $("body").prepend("<div id='popup' style='background-color: #fff; position: absolute; top: 0px; left: 0px; z-index: 1001; display: none; padding: 15px;'>&nbsp;</div>");
 $("#popup").html(html).css({top: "50px", left: eval($(document).width()-$("#popup").width())/2+"px"});
 $("#bgfade").height($(document).height()).width($(document).width()).css({opacity: "0.5"});
 $("#bgfade").fadeIn(500, function() { $("#popup").show(); $("[focusme=true]").focus(); }).attr("visible","true");
 $("[popdown=true]").click(function() { popdown(); });
}

function popdown()
{
 $("#bgfade").fadeOut(500).attr("visible","false");
 $("#popup").hide();
}

function resizepopup()
{
 $("#bgfade").animate({width: $(window).width()+"px", height: $(window).height()+"px"}, 500);
 $("#popup").animate({left: eval($(window).width()-$("#popup").width())/2+"px"}, 500);
}


