function ModelPopup($link, $elem, useHeaderText, title, height, width) {
    $link.click(function() {
        $(".ui-dialog-content").remove(); $clone = $elem.clone(); var titleText = title; if (useHeaderText) { titleText = $clone.find(".ui-widget-header:eq(0)").hide().text(); } else { $clone.find(".ui-widget-header:eq(0)").hide(); }
        $clone.attr("title", titleText).dialog({ bgiframe: true, height: height, width: width, modal: true, open: function(event, ui) { $elem.hide(); }, beforeclose: function(event, ui) { $elem.show(), $("#proddet").css("display", "inline"); } }); return false;
    });
}
