Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.44
diff -u -r1.44 system.admin.inc
--- modules/system/system.admin.inc	22 Dec 2007 23:24:25 -0000	1.44
+++ modules/system/system.admin.inc	26 Dec 2007 07:16:17 -0000
@@ -318,6 +318,8 @@
  * @see system_theme_settings_submit().
  */
 function system_theme_settings(&$form_state, $key = '') {
+  drupal_add_js(drupal_get_path('module', 'system') .'/system.js');
+
   $directory_path = file_directory_path();
   file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path');
 
@@ -434,6 +436,14 @@
   }
 
   // Logo settings
+
+  // If JS is enabled, and the checkbox is defaulting to off, hide custom settings
+  // on page load via .css using the js-hide class so that there's no flicker.
+  $css_class = 'system-logo-settings';
+  if ($settings['default_logo']) {
+    $css_class .= ' js-hide';
+  }
+
   if ((!$key) || in_array('logo', $features)) {
     $form['logo'] = array(
       '#type' => 'fieldset',
@@ -446,45 +456,61 @@
       '#title' => t('Use the default logo'),
       '#default_value' => $settings['default_logo'],
       '#tree' => FALSE,
-      '#description' => t('Check here if you want the theme to use the logo supplied with it.')
+      '#prefix' => '<div class="system-logo-checkbox">',
+      '#suffix' => '</div>',
+      '#description' => t('Check here if you want the theme to use the logo supplied with it.'),
     );
     $form['logo']['logo_path'] = array(
       '#type' => 'textfield',
       '#title' => t('Path to custom logo'),
       '#default_value' => $settings['logo_path'],
-      '#description' => t('The path to the file you would like to use as your logo file instead of the default logo.'));
-
+      '#prefix' => '<div class="'. $css_class .'">',
+      '#description' => t('The path to the file you would like to use as your logo file instead of the default logo.'),
+    );
     $form['logo']['logo_upload'] = array(
       '#type' => 'file',
       '#title' => t('Upload logo image'),
       '#maxlength' => 40,
-      '#description' => t("If you don't have direct file access to the server, use this field to upload your logo.")
+      '#suffix' => '</div>',
+      '#description' => t("If you don't have direct file access to the server, use this field to upload your logo."),
     );
   }
 
+  // Icon settings
+
+  // If JS is enabled, and the checkbox is defaulting to off, hide custom settings
+  // on page load via .css using the js-hide class so that there's no flicker.
+  $css_class = 'system-favicon-settings';
+  if ($settings['default_favicon']) {
+    $css_class .= ' js-hide';
+  }
+
   if ((!$key) || in_array('favicon', $features)) {
     $form['favicon'] = array(
       '#type' => 'fieldset',
       '#title' => t('Shortcut icon settings'),
-      '#description' => t("Your shortcut icon, or 'favicon', is displayed in the address bar and bookmarks of most browsers.")
+      '#description' => t("Your shortcut icon, or 'favicon', is displayed in the address bar and bookmarks of most browsers."),
     );
     $form['favicon']['default_favicon'] = array(
       '#type' => 'checkbox',
       '#title' => t('Use the default shortcut icon.'),
       '#default_value' => $settings['default_favicon'],
-      '#description' => t('Check here if you want the theme to use the default shortcut icon.')
+      '#prefix' => '<div class="system-favicon-checkbox">',
+      '#suffix' => '</div>',
+      '#description' => t('Check here if you want the theme to use the default shortcut icon.'),
     );
     $form['favicon']['favicon_path'] = array(
       '#type' => 'textfield',
       '#title' => t('Path to custom icon'),
       '#default_value' => $settings['favicon_path'],
-      '#description' => t('The path to the image file you would like to use as your custom shortcut icon.')
+      '#prefix' => '<div class="'. $css_class .'">',
+      '#description' => t('The path to the image file you would like to use as your custom shortcut icon.'),
     );
-
     $form['favicon']['favicon_upload'] = array(
       '#type' => 'file',
       '#title' => t('Upload icon image'),
-      '#description' => t("If you don't have direct file access to the server, use this field to upload your shortcut icon.")
+      '#suffix' => '</div>',
+      '#description' => t("If you don't have direct file access to the server, use this field to upload your shortcut icon."),
     );
   }
 
@@ -1249,18 +1275,35 @@
  * @see system_settings_form().
  */
 function system_performance_settings() {
+  drupal_add_js(drupal_get_path('module', 'system') .'/system.js');
 
-  $description = '<p>'. t("The normal cache mode is suitable for most sites and does not cause any side effects. The aggressive cache mode causes Drupal to skip the loading (boot) and unloading (exit) of enabled modules when serving a cached page. This results in an additional performance boost but can cause unwanted side effects.") .'</p>';
-
+  $cache = variable_get('cache', CACHE_DISABLED);
+  
   $problem_modules = array_unique(array_merge(module_implements('boot'), module_implements('exit')));
   sort($problem_modules);
 
+  // If JS is enabled, and the radio is defaulting to disabled, hide settings
+  // on page load via .css using the js-hide class so that there's no flicker.
+  $css_class_settings = 'system-performance-settings';
+  $css_class_warning = 'system-performance-warning';
+  if ($cache == CACHE_DISABLED) {
+    $css_class_settings .= ' js-hide';
+    $css_class_warning .= ' js-hide';
+  }
+  else if ($cache == CACHE_NORMAL) {
+    $css_class_warning .= ' js-hide';
+  }
+
+  $description = '<p>'. t('The normal cache mode is suitable for most sites and does not cause any side effects. The aggressive cache mode causes Drupal to skip the loading (boot) and unloading (exit) of enabled modules when serving a cached page. This results in an additional performance boost but can cause unwanted side effects.') .'</p>';
+  $description .= '<p class="'. $css_class_warning .'">';
   if (count($problem_modules) > 0) {
-    $description .= '<p>'. t('<strong class="error">The following enabled modules are incompatible with aggressive mode caching and will not function properly: %modules</strong>', array('%modules' => implode(', ', $problem_modules))) .'.</p>';
+    $description .= t('<strong class="error">The following enabled modules are incompatible with aggressive mode caching and will not function properly: %modules</strong>', array('%modules' => implode(', ', $problem_modules)));
   }
   else {
-    $description .= '<p>'. t('<strong class="ok">Currently, all enabled modules are compatible with the aggressive caching policy.</strong> Please note, if you use aggressive caching and enable new modules, you will need to check this page again to ensure compatibility.') .'</p>';
+    $description .= t('<strong class="ok">Currently, all enabled modules are compatible with the aggressive caching policy.</strong> Please note, if you use aggressive caching and enable new modules, you will need to check this page again to ensure compatibility.');
   }
+  $description .= '</p>'; 
+
   $form['page_cache'] = array(
     '#type' => 'fieldset',
     '#title' => t('Page cache'),
@@ -1270,9 +1313,14 @@
   $form['page_cache']['cache'] = array(
     '#type' => 'radios',
     '#title' => t('Caching mode'),
-    '#default_value' => variable_get('cache', CACHE_DISABLED),
-    '#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_NORMAL => t('Normal (recommended for production sites, no side effects)'), CACHE_AGGRESSIVE => t('Aggressive (experts only, possible side effects)')),
-    '#description' => $description
+    '#default_value' => $cache,
+    '#options' => array(
+      CACHE_DISABLED => t('Disabled'),
+      CACHE_NORMAL => t('Normal (recommended for production sites, no side effects)'),
+      CACHE_AGGRESSIVE => t('Aggressive (experts only, possible side effects)')),
+    '#prefix' => '<div class="system-performance-radios">',
+    '#suffix' => '</div>',
+    '#description' => $description,
   );
 
   $period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400), 'format_interval');
@@ -1282,13 +1330,16 @@
     '#title' => t('Minimum cache lifetime'),
     '#default_value' => variable_get('cache_lifetime', 0),
     '#options' => $period,
+    '#prefix' => '<div class="'. $css_class_settings .'">',
     '#description' => t('On high-traffic sites, it may be necessary to enforce a minimum cache lifetime. The minimum cache lifetime is the minimum amount of time that will elapse before the cache is emptied and recreated, and is applied to both page and block caches. A larger minimum cache lifetime offers better performance, but users will not see new content for a longer period of time.')
   );
+
   $form['page_cache']['page_compression'] = array(
     '#type' => 'radios',
     '#title' => t('Page compression'),
     '#default_value' => variable_get('page_compression', TRUE),
     '#options' => array(t('Disabled'), t('Enabled')),
+    '#suffix' => '</div>',
     '#description' => t("By default, Drupal compresses the pages it caches in order to save bandwidth and improve download times. This option should be disabled when using a webserver that performs compression."),
   );
 
@@ -1323,6 +1374,7 @@
     '#options' => array(t('Disabled'), t('Enabled')),
     '#description' => t('This option can interfere with theme development and should only be enabled in a production environment.'),
   );
+
   $form['bandwidth_optimizations']['preprocess_js'] = array(
     '#type' => 'radios',
     '#title' => t('Optimize JavaScript files'),
@@ -1640,19 +1692,33 @@
  * @see system_settings_form().
  */
 function system_site_maintenance_settings() {
+  drupal_add_js(drupal_get_path('module', 'system') .'/system.js');
+
+  $offline = variable_get('site_offline', 0);
 
   $form['site_offline'] = array(
     '#type' => 'radios',
     '#title' => t('Site status'),
-    '#default_value' => variable_get('site_offline', 0),
+    '#default_value' => $offline,
     '#options' => array(t('Online'), t('Off-line')),
+    '#prefix' => '<div class="system-site-maintenance-radios">',
+    '#suffix' => '</div>',
     '#description' => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Off-line", only users with the "administer site configuration" permission will be able to access your site to perform maintenance; all other visitors will see the site off-line message configured below. Authorized users can log in during "Off-line" mode directly via the <a href="@user-login">user login</a> page.', array('@user-login' => url('user'))),
   );
 
+  // If JS is enabled, and the radio is defaulting to off, hide settings
+  // on page load via .css using the js-hide class so that there's no flicker.
+  $css_class = 'system-site-maintenance-settings';
+  if (!$offline) {
+    $css_class .= ' js-hide';
+  }
+
   $form['site_offline_message'] = array(
     '#type' => 'textarea',
     '#title' => t('Site off-line message'),
     '#default_value' => variable_get('site_offline_message', t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')))),
+    '#prefix' => '<div class="'. $css_class .'">',
+    '#suffix' => '</div>',
     '#description' => t('Message to show visitors when the site is in off-line mode.')
   );
 
Index: modules/system/system.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.js,v
retrieving revision 1.14
diff -u -r1.14 system.js
--- modules/system/system.js	17 Dec 2007 23:43:43 -0000	1.14
+++ modules/system/system.js	26 Dec 2007 07:16:17 -0000
@@ -108,3 +108,41 @@
   // Trigger the event handler to show the form input if necessary.
   $('select.date-format', context).trigger('change');
 };
+
+/**
+ * Show/hide 'Site off-line message' on the admin/settings/site-maintenance page.
+ */
+Drupal.behaviors.siteMaintenance = function (context) {
+  $('div.system-site-maintenance-radios input[type=radio]:not(.siteMaintenance-processed)', context).addClass('siteMaintenance-processed').click(function () {
+    $('div.system-site-maintenance-settings', context)[['hide', 'show'][this.value]]();
+  });
+};
+
+/**
+ * Show/hide Aggressive mode description and 'Minimum cache lifetime' on the
+ * admin/settings/performance page.
+ */
+Drupal.behaviors.performance = function (context) {
+  $('div.system-performance-radios input[type=radio]:not(.performance-processed)', context).addClass('performance-processed').click(function () {
+    $('div.system-performance-settings', context)[this.value == 0 ? 'hide' : 'show']();
+    $('p.system-performance-warning', context)[this.value != 2 ? 'hide' : 'show']();
+  });
+};
+
+/**
+ * Show/hide 'Custom logo settings' on the /admin/build/themes/settings page.
+ */
+Drupal.behaviors.customLogo = function (context) {
+  $('div.system-logo-checkbox input[type=checkbox]:not(.siteMaintenance-processed)', context).addClass('siteMaintenance-processed').click(function () {
+    $('div.system-logo-settings', context)[this.checked == true ? 'hide' : 'show']();
+  });
+};
+
+/**
+ * Show/hide 'Custom favicon settings' on the /admin/build/themes/settings page.
+ */
+Drupal.behaviors.customFavicon = function (context) {
+  $('div.system-favicon-checkbox input[type=checkbox]:not(.siteMaintenance-processed)', context).addClass('siteMaintenance-processed').click(function () {
+    $('div.system-favicon-settings', context)[this.checked == true ? 'hide' : 'show']();
+  });
+};
