title: How can I make jQuery UI Dialogs open in a new window?
body: <p>I have a web application that has a number of dialogs that pop up that contain controls that modify various attributes of a data model. I'm currently displaying these dialogs using a jQuery UI Dialog. A new requirement is that users want to be able to pop the dialog out of the current window. I can create a new window containing the controls like this:</p>
  
  <pre><code>function OpenSidebarInNewWindow(){
      var DialogName = 'AdditionalDetailsDiv';
      var OpenWindow=window.open("", "newwin", "height=250, width=250,toolbar=no,scrollbars="+scroll+",menubar=no");
      OpenWindow.document.write("&lt;HTML&gt;");
      OpenWindow.document.write("&lt;TITLE&gt;" + DialogName + "&lt;/TITLE&gt;");
      OpenWindow.document.write("&lt;BODY&gt;");
      OpenWindow.document.write(window.document.getElementById(DialogName).innerHTML);
      OpenWindow.document.write("&lt;/BODY&gt;");
      OpenWindow.document.write("&lt;/HTML&gt;");
  
  }
  </code></pre>
  
  <p>But the problem is any event handlers I have on those controls are scoped to the parent window's "window". Is there any way that I can modify the Function.prototype or something on the child page to try to call window.opener[function] if window[function] doesn't exist?</p>
  
  <p>If not, can anyone suggest a better way to handle this situation?</p>