Index: modules/comment/comment.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.js,v
retrieving revision 1.12
diff -u -p -r1.12 comment.js
--- modules/comment/comment.js	31 Aug 2009 05:51:08 -0000	1.12
+++ modules/comment/comment.js	7 Oct 2009 01:03:37 -0000
@@ -4,7 +4,7 @@
 Drupal.behaviors.comment = {
   attach: function (context, settings) {
     $.each(['name', 'homepage', 'mail'], function () {
-      var cookie = Drupal.comment.getCookie('comment_info_' + this);
+      var cookie = $.cookie('Drupal.user.' + this);
       if (cookie) {
         $('#comment-form input[name=' + this + ']', context).once('comment').val(cookie);
       }
@@ -12,25 +12,4 @@ Drupal.behaviors.comment = {
   }
 };
 
-Drupal.comment = {};
-
-Drupal.comment.getCookie = function (name) {
-  var search = name + '=';
-  var returnValue = '';
-
-  if (document.cookie.length > 0) {
-    offset = document.cookie.indexOf(search);
-    if (offset != -1) {
-      offset += search.length;
-      var end = document.cookie.indexOf(';', offset);
-      if (end == -1) {
-        end = document.cookie.length;
-      }
-      returnValue = decodeURIComponent(document.cookie.substring(offset, end).replace(/\+/g, '%20'));
-    }
-  }
-
-  return returnValue;
-};
-
 })(jQuery);
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.775
diff -u -p -r1.775 comment.module
--- modules/comment/comment.module	29 Sep 2009 15:31:14 -0000	1.775
+++ modules/comment/comment.module	7 Oct 2009 01:03:37 -0000
@@ -1623,7 +1623,8 @@ function comment_form($form, &$form_stat
   $node = node_load($comment->nid);
 
   if (!$user->uid && variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
-    $form_state['#attached']['js'][] = drupal_get_path('module', 'comment') . '/comment.js';
+    $form['#attached']['library'][] = array('system', 'cookie');
+    $form['#attached']['js'][] = drupal_get_path('module', 'comment') . '/comment.js';
   }
 
   $comment = (array) $comment;
@@ -1940,18 +1941,10 @@ function comment_preview($comment) {
  */
 function comment_form_validate($form, &$form_state) {
   global $user;
+
   $comment = (object) $form_state['values'];
   field_attach_form_validate('comment', $comment, $form, $form_state);
 
-  if ($user->uid === 0) {
-    foreach (array('name', 'homepage', 'mail') as $field) {
-      // Set cookie for 365 days.
-      if (isset($form_state['values'][$field])) {
-        setcookie('comment_info_' . $field, $form_state['values'][$field], REQUEST_TIME + 31536000, '/');
-      }
-    }
-  }
-
   if (isset($form_state['values']['date'])) {
     if (strtotime($form_state['values']['date']) === FALSE) {
       form_set_error('date', t('You have to specify a valid date.'));
@@ -2051,6 +2044,18 @@ function comment_form_submit_build_comme
  * Process comment form submissions; prepare the comment, store it, and set a redirection target.
  */
 function comment_form_submit($form, &$form_state) {
+  global $user;
+
+  // Save the anonymous user information as a cookie so it can be reused.
+  if (!$user->uid) {
+    foreach (array('name', 'homepage', 'mail') as $field) {
+      if (isset($form_state['values'][$field])) {
+        // Set cookie for 365 days.
+        setrawcookie('Drupal.user.' . $field, rawurlencode($form_state['values'][$field]), REQUEST_TIME + 31536000, '/');
+      }
+    }
+  }
+
   $node = node_load($form_state['values']['nid']);
   $comment = comment_form_submit_build_comment($form, $form_state);
   if (user_access('post comments') && (user_access('administer comments') || $node->comment == COMMENT_NODE_OPEN)) {
@@ -2100,12 +2105,12 @@ function template_preprocess_comment(&$v
   $variables['signature'] = $comment->signature;
   $variables['title']     = l($comment->subject, 'comment/' . $comment->cid, array('fragment' => "comment-$comment->cid"));
   $variables['template_files'][] = 'comment-' . $variables['node']->type;
-  
+
   // Helpful $content variable for templates.
   foreach (element_children($variables['elements']) as $key) {
     $variables['content'][$key] = $variables['elements'][$key];
   }
-  
+
   // Set status to a string representation of comment->status.
   if (isset($comment->in_preview)) {
     $variables['status']  = 'comment-preview';
@@ -2429,4 +2434,3 @@ function comment_filter_format_delete($f
     ->condition('format', $format->format)
     ->execute();
 }
-
Index: modules/contact/contact.js
===================================================================
RCS file: modules/contact/contact.js
diff -N modules/contact/contact.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/contact/contact.js	7 Oct 2009 01:03:37 -0000
@@ -0,0 +1,15 @@
+// $Id$
+(function ($) {
+
+Drupal.behaviors.contact = {
+  attach: function(context) {
+    $.each(['name', 'mail'], function () {
+      var cookie = $.cookie('Drupal.user.' + this);
+      if (cookie) {
+        $('#contact-site-form input[name=' + this + ']', context).once('comment').val(cookie);
+      }
+    });
+  }
+};
+
+})(jQuery);
Index: modules/contact/contact.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.pages.inc,v
retrieving revision 1.26
diff -u -p -r1.26 contact.pages.inc
--- modules/contact/contact.pages.inc	29 Sep 2009 15:31:14 -0000	1.26
+++ modules/contact/contact.pages.inc	7 Oct 2009 01:03:37 -0000
@@ -32,7 +32,7 @@ function contact_site_page() {
 /**
  * Form builder; the site-wide contact form.
  */
-function contact_site_form() {
+function contact_site_form($form, &$form_state) {
   global $user;
 
   $categories = db_query("SELECT cid, category FROM {contact} ORDER BY weight, category")->fetchAllKeyed();
@@ -49,6 +49,11 @@ function contact_site_form() {
     }
   }
 
+  if (!$user->uid) {
+    $form['#attached']['library'][] = array('system', 'cookie');
+    $form['#attached']['js'][] = drupal_get_path('module', 'contact') . '/contact.js';
+  }
+
   $form['#token'] = $user->uid ? $user->name . $user->mail : '';
   $form['name'] = array(
     '#type' => 'textfield',
@@ -114,7 +119,17 @@ function contact_site_form_validate($for
  * Form submission handler for contact_site_form().
  */
 function contact_site_form_submit($form, &$form_state) {
-  global $language;
+  global $user, $language;
+
+  // Save the anonymous user information as a cookie so it can be reused.
+  if (!$user->uid) {
+    foreach (array('name', 'mail') as $field) {
+      if (isset($form_state['values'][$field])) {
+        // Set cookie for 365 days.
+        setrawcookie('Drupal.user.' . $field, rawurlencode($form_state['values'][$field]), REQUEST_TIME + 31536000, '/');
+      }
+    }
+  }
 
   $values = $form_state['values'];
 
