n00b question about dialog('open'), ('close'), ('remove') and form results

n00b question about dialog('open'), ('close'), ('remove') and form results


Hello-
I am trying to use UI dialog to create a modal file upload window,
with the help of jquploader.
I am setting the dialog autoOpen to false, and then triggering the
window with dialog('open') when an <a> tag is clicked. This works
fine.
The file uploads correctly, and all is well. I close the dialog using
the "X" in the corner.
The problem comes when I want to upload another file. If I click the
<a> again, the dialog opens with the previous results. I want it to
open with a fresh copy of my form.
I tried using dialog('destroy').remove(); , but then of course I can't
open it again.
I think I just don't understand how to reinitialize the dialog, or
where that should be done. Here is what my script currently looks
like:
<script type="text/javascript">
$(document).ready(function(){
    $('#example3').jqUploader({
    background: 'FFFFFF',
    barColor: '66CC00',
    src: 'jqUploader.swf',
    afterScript: 'none',
    height:100,
    width: 400,
    params: {menu:false}
    });
    $('#modal_imageupload').dialog({
modal: true,
    autoOpen: false,
    position: 'center',
    resizable: 'false',
    height: 175,
    width: 450,
overlay: {
opacity: 0.5,
background: "black"
}
    });
    $('#upload1').click(function() {
        $('#modal_imageupload').dialog('open')
});
    $('a.ui-dialog-titlebar-close').click(function() {
        $('#modal_imageupload').dialog('destroy').remove();
    });
});
</script>