--- jquery_ui.module	2009-04-28 22:55:10.000000000 +0530
+++ jquery_ui_new.module	2009-04-28 22:57:17.000000000 +0530
@@ -25,11 +25,15 @@ define('JQUERY_UI_PATH', drupal_get_path
  *   An array of what additional files (other than UI core) should be loaded
  *   on the page, or a string with a single file name.
  */
-function jquery_ui_add($files = array()) {
+function jquery_ui_add($files = array(), $theme = NULL) {
   static $loaded_files, $ui_core, $effects_core;
   $jquery_ui_path = JQUERY_UI_PATH . '/ui';
   $compression = variable_get('jquery_update_compression_type', 'mini');
 
+  // Set the theme.
+  $theme_name = $theme ? $theme : variable_get('jquery_ui_theme', 'base');
+  $theme_path = JQUERY_UI_PATH . '/themes/' . $theme_name;
+
   // Convert file to an array if it's not one already, to compensate for
   // lazy developers. ;)
   if (!is_array($files)) {
@@ -39,7 +43,9 @@ function jquery_ui_add($files = array())
   // If core hasn't been added yet, add it.
   if (!isset($ui_core)) {
     $ui_core = TRUE;
-    jquery_ui_add(array('ui.core'));
+    jquery_ui_add(array('ui.core'), $theme);
+    drupal_add_css($theme_path . '/ui.core.css');
+    drupal_add_css($theme_path . '/ui.theme.css');
   }
 
   // Loop through list of files to include and add them to the page.
@@ -47,7 +53,7 @@ function jquery_ui_add($files = array())
     // Any effects files require the effects core file.
     if (!isset($effects_core) && strpos($file, 'effects.') === 0) {
       $effects_core = TRUE;
-      jquery_ui_add(array('effects.core'));
+      jquery_ui_add(array('effects.core'), $theme);
     }
   
     // Load other files.
@@ -66,6 +72,8 @@ function jquery_ui_add($files = array())
       }
       $js_path = $jquery_ui_path . '/' . $file_path;
       drupal_add_js($js_path);
+      $css_path = $theme_path . '/' . $file . '.css';
+      drupal_add_css($css_path);
       $loaded_files[$file] = $js_path; // or TRUE...
     }
   }
@@ -83,3 +91,36 @@ function jquery_ui_get_version() {
 
   return $version;
 }
+
+/**
+ * Implementation of hook_menu()
+ */
+function jquery_ui_menu() {
+  $items['admin/settings/jquery_ui'] = array(
+    'title' => 'jQuery UI',
+    'description' => 'Configure settings for jQuery UI module.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('jquery_ui_settings'),
+    'access arguments' => array('administer site configuration'),
+  );
+  return $items;
+}
+
+function jquery_ui_settings() {
+  $theme_path = JQUERY_UI_PATH . '/themes';
+  $files = file_scan_directory($theme_path, '.*', array('.', '..', 'CVS', '.DS_Store'), 0, FALSE, 'basename');
+
+  $options = array();
+  foreach ($files as $name => $file) {
+    $options[$name] = $name;
+  }
+
+  $form['jquery_ui_theme'] = array(
+    '#type' => 'radios',
+    '#title' => t('Choose jQuery UI theme'),
+    '#default_value' => variable_get('jquery_ui_theme', 'base'),
+    '#options' => $options,
+  );
+
+  return system_settings_form($form);
+}
