This uses some script and a name at the buttons that you want to close pop-up layers.
If you click one of the buttons at the top two pop-up layers should be opened. All other pop-ups are closed by the script.
That is not what you are after yet, but is just an oder example from another thread.
I added the same name to the links on the pop-up layers and if you click these also all pop-ups are clodes and the site scrolls down to the anchors.
Bookmarks