title: jquery dialog close not fired
body: <p>I have defined my dialog on the page load. I can see the dialog and everything seems to be fine so far:</p>
  
  <pre><code>dlg1 = $("#modalHolder");
  dlg1 = dlg1.dialog({
      width: 300,
      height: 150,
      modal: true,
      autoOpen: false,
      resizable: false,
      closeOnEscape: false,
      draggable: false,
      overlay: {
          backgroundColor: 'red',
          opacity: 0.65
      },
      open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
  });
  </code></pre>
  
  <p>Now I would like to set the close event dynamically, so I tried this:</p>
  
  <pre><code>function setCloseFunction(fun)
  {
      dlg1.dialog({
          close: function(event, ui)
          {
            alert("2");
            fun();
          }
      });
  }
  </code></pre>
  
  <p>And I call it as:</p>
  
  <pre><code>setCloseFunction(new Function("alert('1')"));
  </code></pre>
  
  <p>However when closing the dialog, the alert never appears. Any ideas?</p>