This is most likely your problem:
When you write to a document closing the document flushes the buffer and prints to the document, it's a very common mistake for new coders. If you load an actual PAGE in the URL parameter, you don't need to close it.
While we're on it this is something you probably want to add:
var day = new Date();
var id = day.getTime();
Note the removed quotes around id because it is now a variable. With your previous code, every "new window" called by this method would open in the SAME window. Assigning a relatively unique ID to the window forces a NEW one to open each time.
The reason this is important is if you're calling the same sub from various pages and the user leaves the initial pop-up open, the'll click new pop-ups and it will appear that "nothing happens" even though it's loading in the initial new window, which is now behind the current window . . . .