Pop up replacenent problem

im having a big problem with my pop ups. at the moment i am using the code form this tutorial (http://www.kirupa.com/developer/mx/centered_popup.htm). The windows pop up, the problem lies in that the pop ups wont replace each other. if one pop up is open, trying to open another one just makes the old pop up active, it doesnt open the contents of the new one. this is a big problem since the pop ups are for my portfolio to show the work at larger sizes. is there a way to tell the new pop up to close the old one and then open? would this be some sort of if… else statment? or is there some other code i should use for the pop ups? either way, please tell me how to do this, i am not good at any type of programming. thanks!