// show the node as a modal window at the center of the window
show_modal = function(node){
    var html = $("html");
    var body = html.children("body");
    var focus_overlay = $('<div id="modal_overlay"></div>');
    focus_overlay.css("width", ""+screen.width+"px").css("height", ""+screen.height+"px").css("position", "absolute");
    focus_overlay.css("left", "0").css("top", "0").css("margin", "0");
    focus_overlay.css("background-color", "rgba(0, 0, 0, 0.5)").css("z-index", "100");
    body.prepend(focus_overlay);
    var frame = $("<div></div>");
    focus_overlay.append(frame);
    frame.css("margin", "auto").css("background-color", body.css("background-color"));
    frame.css("width", "800px");

    frame.append(node);
    node.find("*").each(function() {$(this).css("max-width", frame.innerWidth());});
    node.children("table").each(function() {
	    var table = $(this);
	    var margin = table.outerWidth(true) - table.width();
	    var available_width = node.innerWidth()
	    table.css("width", available_width - margin);

	});

}

hide_modal = function(){
    $("div#modal_overlay").remove();
}
