I have an idea for a social network site. I know Facebook has many patents and I'm afraid of violating one of some of them. I'm not located in the US, main questions:
Research "software patents"
Check out "Enough Is Enough" a popular blog post written by Fred Wilson.
http://www.avc.com/a_vc/2011/06/enough-is-enough.html This info should lead you in the right direction.
Definitely consult with a lawyer.
Start with a lawyer in your country and ask him if he can search US patents.
In the mean time, keep working out your idea. There is a lot that can be done before actually going in to the production of it.