Pop up pro on close?

Is there a js function that is called on close of the pop up? I want to trigger an event when the pop up closes to check if a user has logged in or not. If they have logged in I want to redirect them to a different page or change some styles on the page depending on the situation. All I would need to know is the event or function so I can set up the rest.