Keeping the music going

I love listening to last.fm's similar artist radio stations. I constantly forget that the music I am listening to is coming from one of my Firefox tabs, and will accidentally close it from time to time, stopping whatever music is playing.

I decided to fix this for myself using a ridiculously short Greasemonkey script, using the window object's “onbeforeunload” function to make sure I actually meant to close the tab/window.

Here it is for consumption. This is obviously not a work of genius or of any considerable effort, just a fix for my own absentmindedness.

Updated:
I added a little more functionality to the script. There is now a button that will show up in the top right corner that will let you turn off and on the close prompt so that you can browse the last.fm without getting the 'Are you sure?' prompt on every page load.