note: This will not work on Drupal 6 or Drupal 5. This is based on the code found in the Cosign module.