Hi there,
So presumably you have some form of database of your users and what their Facebook profiles are? So in your database store also the user's Facebook ID. Then, when someone logs in, for each friend in their friend list, take the friend's Facebook ID and see if it is in your database. If it is, voila that friend is connected, if it isn't then that friend isn't connected to your site.
Data e.g.
User 1:
FacebookID: 0001
Username: John
User 2:
FacebookID: 0002
Username: Jane
When User 2 logs in, get her friend list from Facebook. Facebook returns something like:
Friends:
Friend1: FacebookID: 0001
Go through each friend in the list (in this example a list of one):
FOR EACH AFriend in Friends
IF (From MyDatabase.Users WHERE FacebookID == AFriend.FacebookID SELECT Friends).COUNT > 0)
Friend is connected
ELSE
Friend is not connected
END FOR EACH
Hope this helps,
Ed