I am pretty sure, but I may be wrong, that when you open a window, it returns a window object.

var myNewWindow = window.open("whatever")

To manage that window, you would use myNewWindow. You can store it in whatever variable or array of variables that you want.



I believe there are also window names that work something like:
window.open("url", "myWindowName")

such that you can reference:
window.myWindowName.close(), etc.



That markup may be incorrect, as I don't ever use windows ever. Popup blockers kinda killed the window.open() usefulness, and I don't oppose that.