You folks have been very helpful in showing me how to set up ToolTips to show popups on one of my web pages. Everything works great, except that some of the targets are close to the margin, causing the popup to be positioned partly off the screen.

I've tried to find the solution online but haven't been able to make it work.

How would I edit the code below to assure that all popups would be completely on the screen?