Layout: Log out link

and display links only if user is logged in
determine_type for smart message type guessing
Removed unnecessary js