Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.170
diff -u -d -F^\s*function -r1.170 form.inc
--- includes/form.inc	2 Jan 2007 05:58:53 -0000	1.170
+++ includes/form.inc	4 Jan 2007 19:56:18 -0000
@@ -972,7 +972,7 @@ function form_get_option_key($element, $
  *   A themed HTML string representing the form item group.
  */
 function theme_fieldset($element) {
-  if ($element['#collapsible']) {
+  if (isset($element['#collapsible']) && $element['#collapsible'] && variable_get('javascript_collapse', TRUE)) {
     drupal_add_js('misc/collapse.js');
 
     if (!isset($element['#attributes']['class'])) {
@@ -1335,7 +1335,7 @@ function theme_textfield($element) {
   $extra = '';
   $output = '';
 
-  if ($element['#autocomplete_path']) {
+  if (isset($element['#autocomplete_path']) && $element['#autocomplete_path'] && variable_get('javascript_autocomplete', TRUE)) {
     drupal_add_js('misc/autocomplete.js');
     $class[] = 'form-autocomplete';
     $extra =  '<input class="autocomplete" type="hidden" id="'. $element['#id'] .'-autocomplete" value="'. check_url(url($element['#autocomplete_path'], NULL, NULL, TRUE)) .'" disabled="disabled" />';
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.336
diff -u -d -F^\s*function -r1.336 theme.inc
--- includes/theme.inc	2 Jan 2007 05:05:38 -0000	1.336
+++ includes/theme.inc	4 Jan 2007 19:56:20 -0000
@@ -815,8 +815,10 @@ function theme_table($header, $rows, $at
  * Returns a header cell for tables that have a select all functionality.
  */
 function theme_table_select_header_cell() {
-  drupal_add_js(array('tableSelect' => array('selectAll' => t('Select all rows in this table'), 'selectNone' => t('Deselect all rows in this table'))), 'setting');
-  drupal_add_js('misc/tableselect.js');
+  if (variable_get('javascript_tableselect', TRUE)) {
+    drupal_add_js(array('tableSelect' => array('selectAll' => t('Select all rows in this table'), 'selectNone' => t('Deselect all rows in this table'))), 'setting');
+    drupal_add_js('misc/tableselect.js');
+  }
 
   return array('class' => 'select-all');
 }
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.435
diff -u -d -F^\s*function -r1.435 system.module
--- modules/system/system.module	2 Jan 2007 05:05:38 -0000	1.435
+++ modules/system/system.module	4 Jan 2007 19:56:26 -0000
@@ -233,6 +233,12 @@ function system_menu($may_cache) {
       'callback' => 'drupal_get_form',
       'callback arguments' => array('system_performance_settings'));
     $items[] = array(
+      'path' => 'admin/settings/javascript',
+      'title' => t('Javascript'),
+      'description' => t('Select what Javascript enhanced functionalities are available on your site.'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_javascript_settings'));
+    $items[] = array(
       'path' => 'admin/settings/file-system',
       'title' => t('File system'),
       'description' => t('Tell Drupal where to store uploaded files and how they are accessed.'),
@@ -701,6 +707,35 @@ function system_performance_settings() {
   return system_settings_form($form);
 }
 
+function system_javascript_settings() {
+  $form = array();
+
+  $form['javascript_autocomplete'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Autocompletion'),
+    '#default_value' => variable_get('javascript_autocomplete', TRUE),
+    '#description' => t('Defines whether certain textfields show autocomplete suggestions when typing.'),
+  );
+
+  $form['javascript_tableselect'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Mass checkbox selection'),
+    '#default_value' => variable_get('javascript_tableselect', TRUE),
+    '#description' => t('Defines whether columns of checkboxes can be easily toggled with a "check all" checkbox.'),
+  );
+
+  $form['javascript_collapse'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Collapsible fieldsets'),
+    '#default_value' => variable_get('javascript_collapse', TRUE),
+    '#description' => t('Defines whether fieldsets can be collapsed by clicking on its legend.'),
+  );
+
+  $form['buttons'] = array('#weight' => 20);
+
+  return system_settings_form($form);
+}
+
 function system_file_system_settings() {
 
   $form['file_directory_path'] = array(
Index: modules/upload/upload.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v
retrieving revision 1.147
diff -u -d -F^\s*function -r1.147 upload.module
--- modules/upload/upload.module	2 Jan 2007 10:25:33 -0000	1.147
+++ modules/upload/upload.module	4 Jan 2007 19:56:28 -0000
@@ -348,11 +348,22 @@ function upload_form_alter($form_id, &$f
     );
   }
 
+  if ($form_id == 'system_javascript_settings') {
+    $form['javascript_upload'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Inline file uploads'),
+      '#default_value' => variable_get('javascript_upload', TRUE),
+      '#description' => t('If checked, file uploads can be submitted without reloading the entire page.'),
+    );
+  }
+
   if (isset($form['type'])) {
     $node = $form['#node'];
     if ($form['type']['#value'] .'_node_form' == $form_id && variable_get("upload_$node->type", TRUE)) {
-      drupal_add_js('misc/progress.js');
-      drupal_add_js('misc/upload.js');
+      if (variable_get('javascript_upload', TRUE)) {
+        drupal_add_js('misc/progress.js');
+        drupal_add_js('misc/upload.js');
+      }
 
       // Attachments fieldset
       $form['attachments'] = array(
