Index: fieldset_helper.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fieldset_helper/fieldset_helper.admin.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 fieldset_helper.admin.inc
--- fieldset_helper.admin.inc	23 Apr 2009 20:43:32 -0000	1.1.2.1
+++ fieldset_helper.admin.inc	18 Aug 2009 20:57:51 -0000
@@ -65,6 +65,24 @@ function fieldset_helper_admin_settings(
     '#submit' => array('fieldset_helper_clear_fieldset_id_lookup_submit'),
   );
 
+  // Cookie duration
+  $form['fieldset_helper_cookie_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Cookie duration'),
+    '#description' => t("The 'Fieldset helper' module saves the current fieldset state in a client-side browser cookie.") .' '.
+	t("By default, this is a session cookie which is cleared when the user closes the browser.") .' '.
+	t("Changing the 'Cookie duration' to a non-zero number makes the cookie persist even after the browser is closed and restarted."),
+  );
+
+  $form['fieldset_helper_cookie_settings']['fieldset_helper_cookie_duration'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Cookie duration'),
+    '#default_value' => variable_get('fieldset_helper_cookie_duration', 0),
+    '#size' => 5,
+    '#maxlength' => 5,
+    '#description' => t("For how many days should the cookie persist after the client browser is closed?"),
+  );
+
   return system_settings_form($form);
 }
 
Index: fieldset_helper.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fieldset_helper/fieldset_helper.install,v
retrieving revision 1.1
diff -u -p -r1.1 fieldset_helper.install
--- fieldset_helper.install	2 Apr 2009 17:20:43 -0000	1.1
+++ fieldset_helper.install	18 Aug 2009 19:57:40 -0000
@@ -12,6 +12,7 @@
 function fieldset_helper_install() {
   // Set variables
   variable_set('fieldset_helper_auto_exclude', array());
+  variable_set('fieldset_helper_cookie_duration', 0);
 
   // Set the weight to 1000. This module needs to be called after all other modules
   // have executed their hook_form_alter() functions.
Index: fieldset_helper.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fieldset_helper/fieldset_helper.js,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 fieldset_helper.js
--- fieldset_helper.js	21 Jul 2009 15:48:18 -0000	1.1.2.3
+++ fieldset_helper.js	18 Aug 2009 21:02:07 -0000
@@ -170,7 +170,13 @@ Drupal.FieldsetHelper.StateManager.save 
   for(id in this.states) {
     values.push(id + '.' + this.states[id]);
   }
-	document.cookie = 'fieldset_helper_state_manager=' + values.join('_');
+  var expiration = '';
+  if (Drupal.settings['fieldset_helper_cookie_duration']) {
+    var expires = new Date();
+    expires.setTime( expires.getTime() + Drupal.settings['fieldset_helper_cookie_duration'] * 1000 * 60 * 60 * 24 );
+    expiration = '; expires=' + expires.toGMTString();
+  }
+	document.cookie = 'fieldset_helper_state_manager=' + values.join('_') + expiration;
 	// DEBUG: console.log(value);
 }
 	
Index: fieldset_helper.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fieldset_helper/fieldset_helper.module,v
retrieving revision 1.1.2.7
diff -u -p -r1.1.2.7 fieldset_helper.module
--- fieldset_helper.module	13 Aug 2009 13:08:13 -0000	1.1.2.7
+++ fieldset_helper.module	18 Aug 2009 20:01:17 -0000
@@ -358,6 +358,7 @@ function fieldset_helper_state_manager_g
 
     // Initialize state manager js ids
     $settings['fieldset_helper_state_manager']['ids'] = $lookup_id_table;
+    $settings['fieldset_helper_cookie_duration'] = variable_get('fieldset_helper_cookie_duration',0);
     drupal_add_js($settings, 'setting');
   }
 
