--- money.module_ORIG	2011-02-25 03:07:48.000000000 +0100
+++ money.module_MOD	2011-11-29 23:07:48.000000000 +0100
@@ -18,13 +18,20 @@
  * Implementation of hook_theme().
  */
 function money_theme() {
-  return array(
+  $return = array(
     'money_widget' => array('arguments' => array('element' => NULL)),
     'money_formatter_default' => array('arguments' => array('element' => NULL), 'function' => 'theme_money_formatter_generic'),
     'money_formatter_nozeros' => array('arguments' => array('element' => NULL), 'function' => 'theme_money_formatter_generic'),
     'money_formatter_unformatted' => array('arguments' => array('element' => NULL)),
     'money_field' => array('arguments' => array('amount' => NULL, 'currency' => NULL, 'display_options' => NULL, 'separator' => NULL)),
   );
+  
+  if (module_exists('currency_switcher')) {
+    $return['money_formatter_default_no_currency_switcher'] = array('arguments' => array('element' => NULL), 'function' => 'theme_money_formatter_generic');
+    $return['money_formatter_nozeros_no_currency_switcher'] = array('arguments' => array('element' => NULL), 'function' => 'theme_money_formatter_generic');
+    $return['money_formatter_unformatted_no_currency_switcher'] = array('arguments' => array('element' => NULL));
+  }
+  return $return;
 }
 
 /**
@@ -107,11 +114,17 @@
  * Implementation of hook_field_formatter_info().
  */
 function money_field_formatter_info() {
-  return array(
+  $return = array(
     'default' => array('label' => t('Default'), 'field types' => array('money')),
     'nozeros' => array('label' => t('Remove redundant zeros'), 'field types' => array('money')),
     'unformatted' => array('label' => t('Unformatted'), 'field types' => array('money')),
   );
+  if (module_exists('currency_switcher')) {
+    $return['default_no_currency_switcher'] = array('label' => t('Default (no Currency switcher)'), 'field types' => array('money'));
+    $return['nozeros_no_currency_switcher'] = array('label' => t('Remove redundant zeros (no Currency switcher)'), 'field types' => array('money'));
+    $return['unformatted_no_currency_switcher'] = array('label' => t('Unformatted (no Currency switcher)'), 'field types' => array('money'));
+  }
+  return $return;
 }
 
 /**
@@ -194,11 +207,23 @@
         '#checkall' => TRUE,
         '#prefix' => '<div class="money-field-currency-checkboxes">', '#suffix' => '</div>',
       );
+      // Code for including currency switcher
+      if (module_exists('currency_switcher')) {
+	$form['currency_switcher'] = array(
+	  '#title' => t('Add dropdown to select currency'),
+	  '#type' => 'checkboxes',
+	  '#options' => array('currency_switcher' => 'Currency Switcher'),
+	  '#default_value' => isset($widget['currency_switcher']) ? $widget['currency_switcher'] : array(),
+	);
+      }
       drupal_add_css(drupal_get_path('module', 'money') .'/money.css');
       return $form;
 
     case 'save':
-      return array('currency_select_mode', 'currency_display_mode', 'decimals_display_mode', 'allowed_currencies');
+      if (module_exists('currency_switcher')) {
+	return array('currency_select_mode', 'currency_display_mode', 'decimals_display_mode', 'allowed_currencies', 'currency_switcher');
+      }
+      return array('currency_select_mode', 'currency_display_mode', 'decimals_display_mode', 'allowed_currencies', );
   }
 }
 
@@ -401,8 +426,22 @@
   $field = content_fields($element['#field_name'], $element['#type_name']);
   $currency = $element['#item']['currency'];
 
+  // Build the array for currency switcher
+  $currency_switcher = array();
+  if (strpos($element['#formatter'], 'no_currency_switcher') !== FALSE) {
+    $add_currency_switcher = FALSE;
+  } else {
+    $add_currency_switcher = in_array('currency_switcher', $field['widget']['currency_switcher'], TRUE) ? TRUE : FALSE;
+  }
+  $currency_switcher['currency_switcher'] = $add_currency_switcher;
+  $currency_switcher['delta'] = $element['#item']['#delta'];
+  $currency_switcher['field_name'] = $element['#field_name'];
+  $currency_switcher['amount'] = $amount;
+  $currency_switcher['format'] = FALSE;
+  $currency_switcher['decimals'] = (isset($field['decimals']) ? (int)$field['decimals'] : 0);
+
   // Format the whole field based on widget display options.
-  return theme('money_field', $amount, $currency, $field['widget']['currency_display_mode'], ' ');
+  return theme('money_field', $amount, $currency, $field['widget']['currency_display_mode'], ' ', $currency_switcher);
 }
 
 /**
@@ -421,7 +460,7 @@
 
   // The number of decimals depends on the formatter being used and
   // the field options.
-  if ($element['#formatter'] == 'nozeros') {
+  if (($element['#formatter'] == 'nozeros') || ($element['#formatter'] == 'nozeros_no_currency_switcher')) {
     // For this formatter we display only relevant zeros.
     $decimals = -1;
   }
@@ -442,8 +481,23 @@
   // Format the amount.
   $formatted_number = format_number($amount, $decimals);
 
+  // Build the array for currency switcher
+  $currency_switcher = array();
+  $add_currency_switcher = in_array('currency_switcher', $field['widget']['currency_switcher'], TRUE) ? TRUE : FALSE;
+  if (strpos($element['#formatter'], 'no_currency_switcher') !== FALSE) {
+    $add_currency_switcher = FALSE;
+  } else {
+    $add_currency_switcher = in_array('currency_switcher', $field['widget']['currency_switcher'], TRUE) ? TRUE : FALSE;
+  }
+  $currency_switcher['currency_switcher'] = $add_currency_switcher;
+  $currency_switcher['delta'] = $element['#item']['#delta'];
+  $currency_switcher['field_name'] = $element['#field_name'];
+  $currency_switcher['amount'] = $amount;
+  $currency_switcher['format'] = TRUE;
+  $currency_switcher['decimals'] = $decimals;
+
   // Format the whole field based on widget display options.
-  return theme('money_field', $formatted_number, $currency, $field['widget']['currency_display_mode']);
+  return theme('money_field', $formatted_number, $currency, $field['widget']['currency_display_mode'], "\xC2\xA0", $currency_switcher);
 }
 
 /**
@@ -458,10 +512,17 @@
  * @param $separator
  *   The character used as a separator when specified by '+' is display options.
  *   Defaults to non-break space.
+ * @param $currency_switcher
+ *   Currency switcher array of options.
  *
  * @ingroup themeable
  */
-function theme_money_field($amount, $currency, $display_options, $separator = "\xC2\xA0") {
+function theme_money_field($amount, $currency, $display_options, $separator = "\xC2\xA0", $currency_switcher = array( 'currency_switcher' => FALSE )) {
+  // Verify if currency switcher is choosen for this field and if module is installed
+  if ((module_exists('currency_switcher')) && ($currency_switcher['currency_switcher'])) {
+    $divname = 'currency_switcher-' . $currency_switcher['field_name'] . '-' . $currency_switcher['delta'];
+    return currency_switcher_dropdown($currency_switcher['amount'], $currency, $display_options, $divname, $currency_switcher['decimals'], $currency_switcher['format'], $separator);
+  }
   $output = '';
   foreach (explode('|', $display_options) as $option) {
     switch ($option) {
