Open a new browser window on close of current window if user confirms to close current window
===

I have a scenario where if the user tries to close the current browser window then he should be displayed a confirm box. If he confirms to close the window then this window should close and opening the new window with different url.

I tried use the following code by which I'm able to show the confirm box but I'm unable to figure out how to open the new window if user confirms to close the current.

    var preventUnloadPrompt;            
    $('a').live('click', function () { preventUnloadPrompt = true; });
    $('form').live('submit', function () { preventUnloadPrompt = true; });
    $(window).bind("beforeunload", function () {
        if (preventUnloadPrompt)
        { return; }
        else {
            return confirm("quit??");            
        }
    });

Any type of help is appreciated.
Thanks.