I'm attaching an event listener to the window object. Then later in the script, document.write is being used. (I know, it's evil. I have no choice in the matter.) The problem is, the document.write wipes out my listeners. Is is possible to avoid that?
Here's a fiddle that illustrates the problem: http://jsfiddle.net/Fuhzu/