automatic logoff when leaving a page for a particular user and node/page combination
AFAIC you can get current node id from Drupal JS object. Having those id you can send Ajax request to Drupal which performs logout (http://api.drupal.org/api/drupal/modules!user!user.pages.inc/function/user_logout/7)

About JS events for this task you should look on other forurms