Which to show first: login or register screen or both?

I have a site for which I am working to improve user onboarding.

What happens now is that when a user does some action that requires him to be logged in, I make a jQuery popup come up telling him to log in. And if he is not registered, there is a link to registration.

But sometimes I see sites that do it in reverse order and show the "register" screen first.

I guess if you want people to register, the register screen makes more sense, but then it would annoy people who are already registered. No?

What is the best practice for doing this sort of thing? Does it make sense to show both, the register and login form on the same popup?