# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /var/www/aliases/s1s.dev/sites/all/modules/date
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: date_popup/date_popup.module
--- date_popup/date_popup.module Base (BASE)
+++ date_popup/date_popup.module Locally Modified (Based On LOCAL)
@@ -44,18 +44,23 @@
 
 function date_popup_css_options() {
   $version = jquery_ui_get_version();
-  $jquery_ui_path = drupal_get_path('module', 'jquery_ui');
-  $paths = array();
-  switch ($version) {
+  list($major, $minor) = explode('.', $version);
+  $paths = array('' => t('No CSS'));
+  switch ("$major.$minor") {
     case '1.6':
       $paths[drupal_get_path('module', 'date_popup') .'/themes/datepicker.css'] = t('Date Popup default');
-      $paths[$jquery_ui_path .'/jquery.ui/themes/base/ui.datepicker.css'] = t('jQuery UI default');
       break;
     default:
       $paths[drupal_get_path('module', 'date_popup') .'/themes/datepicker.1.7.css'] = t('Date Popup default');
-      $paths[$jquery_ui_path .'/jquery.ui/themes/default/ui.datepicker.css'] = t('jQuery UI default');
       break;
   }
+  $files = file_scan_directory(JQUERY_UI_PATH.'/themes', '.+', array('.', '..', 'CVS'), 0, FALSE);
+  foreach ($files as $file) {
+    if (is_dir($file->filename) && file_exists($file->filename.'/ui.datepicker.css')) {
+      $name = $file->basename == 'base' ? t('jQuery UI Default (base)') : check_plain($file->basename);
+      $paths[$file->filename.'/ui.datepicker.css'] = $name;
+    }
+  }
   return $paths;
 }
 
@@ -69,8 +74,17 @@
     return;
   }
   
-  drupal_add_css(variable_get('date_popup_css_file', date_popup_css_default()));
+  $css = variable_get('date_popup_css_file', date_popup_css_default());
   
+  if ($css) {
+    drupal_add_css($css);
+
+    // Add theme CSS as well when we're using a jQuery UI theme.
+    if (stristr($css, 'ui.datepicker.css')) {
+      drupal_add_css(str_replace('ui.datepicker.css', 'ui.theme.css', $css));
+    }
+  }
+  
\ No newline at end of file
   if (variable_get('date_popup_timepicker', 'default') == 'default') {
     drupal_add_css(drupal_get_path('module', 'date_popup')  .'/themes/jquery.timeentry.css');
   }
