I can help with that. Basically you just need to show the login button. It automatically turns into a logout button when the person is logged in. Or for a prettier solution you can use the following JavaScript attached to an onclick event handler on a custom logout button:
FB.logout();
Edit: For reference I would recommend reading this page thoroughly because there are some other cool things you can do with the SDK: