1) Detect Fan: You cannot find out if an user is a fan or not using Facebook Javascript. You will have to create separate buttons and render them so that only either one is visible at a time using the visible-to-connection tag. This can then be used to run different Javascript onclick to perform actions for a fan and different actions for a non fan.