Clone the element and use the dialog on that instead
var clone = $("#main-content").clone(true);
var preview = clone.dialog({
modal: true,
width: 1024,
height: 600,
overlay: {
backgroundColor: "#000000",
opacity: 0.5
},
buttons: {
Ok: function () {
$(this).dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
});