Dialog Re-open bug

jQuery-ui dialog widget sometimes has positioning issues when they are re-opened by the user after the user has dragged the dialog.

HTML

<p>Choose a theme first.</p>
<span class='IEGTitle ui-widget'>Dialog widget</span>
<p>Automatically centers a dialog box to display helpful information.</p>
<span class='IEGBorder' onclick='$("#dialog").dialog("open");'> Click me </span>
<div id='dialog'><p>Drag this dialog and close it. 
    When you re-open it, the dialog will incorrectly be at the top of the page.<br>
    Run again. This time if you resize this dialog before dragging it, then close the dialog, when you re-open it, it will re-open in the middle of the page as it should.</p>
</div>
    
<script type="text/javascript" src="http://www.ieginc.net/Resources/js/jqLoader.js"></script>

CSS

body { margin:10px; padding:0px; height:100%; }
.IEGBorder { border: 1px black solid; }

JavaScript

var bwait; // wait on scripts to load, too before doing $ stuff.

function JQLoaded() {
    clearTimeout(bwait);
    // ensure jQuery and all subordinate scripts loaded
    if ((typeof $ != 'undefined') && (typeof $.themeswitcher != 'undefined')) {
        $(document).ready(function() {
            $('#dialog').dialog({
                title: 'Dialog title',
                show: 'slide',
                hide: 'explode',
                autoOpen: false
            });
        });
    } else {
        bwait = setTimeout(JQLoaded, 20);
    }
}
JQLoaded();