Create JS execution blocking dialogs using jQuery
<p>I have an existing web application which uses <code>window.showmodaldialog()</code> to show certain forms and based on the return value it executes some other JavaScripts</p>

<p>For example:</p>

<pre><code>var retVal = window.showmodaldialog('...');

if (retVal==XXX)
  callXXX();
else
  callYYY();
</code></pre>

<p>When <code>showModalDialog()</code> is executed it blocks the JS execution on the main window until the modal is closed.</p>

<p>I am trying to replace these modal Windows with jQuery dialogs but the problem is that once the <code>$(...).dialog().open()</code> is executed the JavaScript execution does not wait for the dialog to be closed.</p>

<p>I know that there are jQuery APIs which allow me to configure a callback function but that involves a lot of changes for me. Is there anyway by which I can pause JavaScript execution until the dialog is closed (I must still be able to execute scripts from the dialog).   </p>
