Right, so a little bit of
overLIB research
later to understand all of those commands listed in that code, and I figured out how to solve the problem on my site. I hope this is useful for you Tomek, but for me, it required no template adjustments.
My problem was pretty much just the end of the $connectionurl string, which seems to try to align the popup div to the Add Connection link ( <a id="cbAddCon"...> )
[code:1]."', CENTER,CLOSECLICK,CLOSETEXT,'"._UE_CLOSE_OVERLIB."',WIDTH,350, ANCHOR,'cbAddConn',ANCHORALIGN,'LR','UR');";[/code:1]
Also, it contains the command "CENTER", which tells the overlib function to center the popup div around the mouse, though that was being overridden by the ANCHOR and ANCHORALIGN commands.
To solve my problem, I just needed to remove
[code:1], ANCHOR,'cbAddConn',ANCHORALIGN,'LR','UR'[/code:1]
and take out
[code:1] CENTER,[/code:1]
Now, the div loads in its default position, which is to the right of and below the mouse position.
Tomek, for your problem, maybe you should check what comes after WIDTH in that last line of code (350 in my example). That number should be what controls the width of the div that pops up. Because of the layout of your profile, the rest of the code should work fine (all the ANCHOR and ANCHORALIGN stuff), but if you're still having trouble, you can try removing it so that it just relies on the mouse position (CENTER, LEFT, or RIGHT) to determine where to position the div.
Good luck!