Does anyone know how to make a popup window appear when a site is left or the browser is closed?

I've tried using the unLoad() method, but that pops up a window when each site page is left, rather than when the doamin is left.

Anyone have any ideas?