Closing a Centered Pop-Up Window

I am using kirupa’s “Launching a Centered Pop-Up Window” from flash which works great - but i need to launch a second popup window which closes the first one.
Any ideas anyone?

I am having the exact same problem. Only I have about 30 pages that are all in popups. There has to be an easier way to let these individual popups open without having to manually close one first. This code above is ok, but would I have to write that code for every single popup I have??