Using Jquery Ui dialog on browser close?

Using Jquery Ui dialog on browser close?

Hi,

I want to display Jquery UI dialog if someone tries to navigate/close the browser.

I am using the following code

  
  1.  function showPopup() {       

                jQuery(document).ready(function() {
                    jQuery("#divPopup").dialog({
                     bgiframe: true, height: 356,width: 600,autoOpen: true, modal: true
                     });
                 };
                return false;
       }
    <body onbeforeunload="return showPopup();">









The Juery UI dialog is shown but the browser (firefox,IE etc) also initiates a dialog

How can I hide the dialog initiated by the browser?


Thanks
-Ankit