Close popup when user clicks outside of the popup area

Howdy,

How can I set the popup that appears to close when a user clicks outside of the popup window?

So that's above, to the left, right or bottom of the popup. If the user clicks anywhere outside, the popup is still there.

Matt