Actually you didn't do too badly, despite the unwiseness of your actions! So, you are basically going to have to SWEAR never to play out of your roll again, because while you'll find plenty of people here to advise you, they won't give you a second chance if you go and do something dumb again.

With $500 I'd start at 5nl or 10nl, depending on your experience and current ability. Remember, this part of your poker craeer has 3 aims, and 3 aims only: gain experience of common (and not so common) situations and how to play them, get better at poker, and build your bankroll slowly and surely so when you ARE better at poker, you can move up safely.