diff --git a/admin_message.module b/admin_message.module
index 90c9a56..003addd 100644
--- a/admin_message.module
+++ b/admin_message.module
@@ -5,6 +5,9 @@
  * Module to display messages that can be individually closed by logged in users.
  */
 
+define('ADMIN_MESSAGE_COOKIE', 'admin_message_notification');
+define('ADMIN_MESSAGE_COOKIE_LIFETIME', 86400 * 365);
+
 /**
  * Implementation of hook_menu().
  */
@@ -58,10 +61,50 @@ function admin_message_nodeapi(&$node, $op, $teaser, $page) {
   }
 }
 
+/**
+ * Sets a cookie for having viewed this node.
+ */
+function _admin_message_set_cookie($nid, $reset = FALSE) {
+  static $cookie = NULL;
+
+  if (is_null($cookie) || $reset) {
+    if (isset($_COOKIE[ADMIN_MESSAGE_COOKIE])) {
+      $cookie = $_COOKIE[ADMIN_MESSAGE_COOKIE];
+    }
+    else {
+      $cookie = array();
+    }
+  }
+
+  if (is_null($nid)) {
+    return $cookie;
+  }
+
+  // add a flag for this message
+  $cookie[$nid] = time();
+
+  // set the cookie header
+  setcookie(ADMIN_MESSAGE_COOKIE . "[$nid]", $cookie[$nid], time() + ADMIN_MESSAGE_COOKIE_LIFETIME, '/');
+}
+
+/**
+ * Returns the timestamp that the user viewed the node or FALSE if they never closed it.
+ */
+function _admin_message_get_cookie($nid) {
+  $cookie = _admin_message_set_cookie(NULL);
+  return isset($cookie[$nid]) ? $cookie[$nid] : FALSE;
+}
+
 function admin_message_close($nid) {
   global $user;
-  db_query('DELETE FROM {admin_message_close} WHERE nid = %d AND uid = %d', $nid, $user->uid);
-  db_query('INSERT INTO {admin_message_close} (nid, uid) VALUES (%d, %d)', $nid, $user->uid);
+  if ($user->uid) {
+    db_query('DELETE FROM {admin_message_close} WHERE nid = %d AND uid = %d', $nid, $user->uid);
+    db_query('INSERT INTO {admin_message_close} (nid, uid) VALUES (%d, %d)', $nid, $user->uid);
+  }
+  else {
+    // For anonymous users we store the value in a cookie
+    _admin_message_set_cookie($nid);
+  }
   drupal_goto();
 }
 
@@ -107,7 +150,12 @@ function admin_message_list_messages() {
   $messages = FALSE;
   while ($item = db_fetch_object($result)) {
     $php_visibility = empty($item->php_visibility) ? TRUE : drupal_eval($item->php_visibility);
-    $closed_by_user = db_fetch_object(db_query("SELECT a.nid FROM {admin_message_close} a WHERE a.nid = %d AND a.uid = %d", $item->nid, $user->uid));
+    if ($user->uid) {
+      $closed_by_user = db_fetch_object(db_query("SELECT a.nid FROM {admin_message_close} a WHERE a.nid = %d AND a.uid = %d", $item->nid, $user->uid));
+    }
+    else {
+      $closed_by_user = _admin_message_get_cookie($item->nid);
+    }
 
     if (empty($closed_by_user) && ($item->created >= $user->created || $item->keep_new) && $php_visibility) {
       $node = node_build_content(node_load($item->nid));
