Well, now I am confused about just what you are trying to accomplish.
And, yes, it is flakey. Sometimes I get the popup, sometimes I
don't.
If clicking anywhere is to close the popup, then how do you
ever get more than one popup at a time? What I find, at least
initially, is that if a popup is present, then I click on another
button, it just closes the first popup. Then, after that, I have
trouble opening any popup by clicking a button.
It's an unsettling user experience, and I'm not sure it
would be otherwise, even if it is fixed. I get confused because there
are both tooltips and popups.
Why not just make the popups modal, and make the user click the X
to close the popup? It's what users expect. They will not get
annoyed or confused or frustrated if they have to press an X.
I just noticed you are using a beta version of jQuery 2.0. Why?
It was never meant for production - just for testing, and to get
feedback from developers about bugs, and it is sure to have bugs!
Update to 2.1.3, but realize that 2.anything is not meant for the
web. If you expect this to work for IE 6,7,8, then use 1.11.2.
Please don't mix using jQuery for DOM search in some places,
and then using native DOM getElementByID() in
others! It can cause problems in some specific instances. Stick to one
or the other!
And I wouldn't use all those IDs and then have your pan()function close them
all. Just use a common CSS class for all of the popups.
I see you "close" the popups by simply setting them to
display:none. I
don't know what your "bPopup" widget is. Is that the way
you are supposed to close it? Usually there is a function you have to call!