Adding code to decide if links or buttons in popup