Index: modules/system/system.js
===================================================================
RCS file: modules/system/system.js
diff -N modules/system/system.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/system/system.js	13 Dec 2006 12:42:55 -0000
@@ -0,0 +1,31 @@
+/**
+ * Check if clean URLs can be enabled using Ajax.
+ */
+Drupal.cleanURLsCheck = function(check_type, url) {
+  if (typeof(check_type) == "undefined") {
+    // Default to the settings page for clean URLs.
+    check_type = "settings";
+  }
+  if (typeof(url) == "undefined") {
+    url = location.pathname + "admin/settings/clean-urls";
+  }
+  if (check_type == "settings") {
+    $("#clean-url-extended-description").hide();
+    $("#clean-url-test").hide();
+  }
+  $.ajax("GET", location.protocol + "//" + location.hostname + url, { data: " " }, function(response) {  
+    if (response.status == 200) {
+      // Check was successful.
+      if (check_type == "settings") {
+        $("#system-clean-url-settings input.form-radio").attr("disabled","");
+        $("<span>" + Drupal.settings.cleanurls.success + "</span>").insertBefore("#clean-url-extended-description");
+      }
+    } 
+    else {
+      // Check failed.
+      if (check_type == "settings") {
+        $("<span>" + Drupal.settings.cleanurls.failure + "</span>").insertBefore("#clean-url-extended-description");
+      }
+    }
+  });
+}
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.424
diff -u -p -r1.424 system.module
--- modules/system/system.module	12 Dec 2006 09:48:47 -0000	1.424
+++ modules/system/system.module	13 Dec 2006 12:42:55 -0000
@@ -579,23 +579,35 @@ function system_site_information_setting
 }
 
 function system_clean_url_settings() {
-  // We check for clean URL support using an image on the client side.
+
   $form['clean_url'] = array(
     '#type' => 'radios',
     '#title' => t('Clean URLs'),
     '#default_value' => variable_get('clean_url', 0),
     '#options' => array(t('Disabled'), t('Enabled')),
-    '#description' => t('This option makes Drupal emit "clean" URLs (i.e. without <code>?q=</code> in the URL.)'),
+    '#description' => t('This option makes Drupal emit "clean" URLs (i.e. without <code>?q=</code> in the URL).'),
   );
 
   if (!variable_get('clean_url', 0)) {
+    $clean_url_success = t(' Your server has been successfully tested to support this feature.');
     if (strpos(request_uri(), '?q=') !== FALSE) {
-      $form['clean_url']['#description'] .= t(' Before enabling clean URLs, you must perform a test to determine if your server is properly configured. If you are able to see this page again after clicking the "Run the clean URL test" link, the test has succeeded and the radio buttons above will be available. If instead you are directed to a "Page not found" error, you will need to change the configuration of your server. The <a href="@handbook">handbook page on Clean URLs</a> has additional troubleshooting information. !run-test', array('@handbook' => 'http://drupal.org/node/15365', '!run-test' => '<a href ="'. base_path() . 'admin/settings/clean-urls">'. t('Run the clean URL test') .'</a>'));
+      drupal_add_js(array('cleanurls' => array('success' => $clean_url_success, 'failure' => t(' Your system does not currently support this feature.'))), 'setting');
+      drupal_add_js(drupal_get_path('module', 'system') .'/system.js', 'module');
+      drupal_add_js('
+// Global Killswitch
+if (Drupal.jsEnabled) {
+  $(document).ready(function() {
+    Drupal.cleanURLsCheck("settings");
+  });
+}', 'inline');
+
+      $form['clean_url']['#description'] .= '<span id="clean-url-extended-description">' . t(' Before enabling clean URLs, you must perform a test to determine if your server is properly configured. If you are able to see this page again after clicking the "Run the clean URL test" link, the test has succeeded and the radio buttons above will be available. If instead you are directed to a "Page not found" error, you will need to change the configuration of your server. The <a href="@handbook">handbook page on Clean URLs</a> has additional troubleshooting information.', array('@handbook' => 'http://drupal.org/node/15365')) . '</span>';
       $form['clean_url']['#disabled'] = TRUE;
+      $form['clean_url']['#suffix'] =  '<p id="clean-url-test">' . t('<a href="@clean_url">Run the clean url test</a>.', array('@clean_url' => base_path() . 'admin/settings/clean-urls')) . '</p>';
+
     }
     else {
-      $form['clean_url']['#description'] .= t(' You have successfully demonstrated that clean URLs work on your server. You may enable/disable them as you wish.');
-      $form['#collapsed'] = FALSE;
+      $form['clean_url']['#description'] .= $clean_url_success;
     }
   }
 
