How can I tell if a form is active from a function?

What I want to do is have a check box menu item to open/close a window. But I need a way to tell if its open so I know to close it and not open it (if you see what I mean!)

Thanks in advance