Replace confirm() with UI Dialog & Custom Buttons

Replace confirm() with UI Dialog & Custom Buttons


I have seen several articles on this so far, but none seem to point me
in the right direction, you guys usually give me pretty straight
forward info so I just need to know how to accomplish this:
    $(window).unload( function () {
    $(foo).dialog();
         } );
And have the same "halting" behavior as confirm();
Thanks