I'm not familiar with NextGen Gallery, but will try to help you sort that out.
Is that behavior caused by s2Member? Does it go away if you deactivate s2Member temporarily?
And could you show me a screenshot of the popup? s2Member doesn't use popups for restricted content, instead it redirects to the Membership Options Page.