diff -rupN currency/currency.css currency_new/currency.css
--- currency/currency.css	1970-01-01 10:00:00.000000000 +1000
+++ currency.css	2010-06-07 10:51:45.000000000 +1000
@@ -0,0 +1,12 @@
+
+/**
+ * CSS for the currenct module.
+ */
+
+#currency-convert-block-equals {
+  text-align: center;
+}
+
+#currency-load-cart-total {
+  cursor: pointer;
+}
diff -rupN currency/currency.module currency_new/currency.module
--- currency/currency.module	2010-01-03 15:00:51.000000000 +1100
+++ currency.module	2010-06-07 16:24:49.000000000 +1000
@@ -32,6 +32,26 @@ function currency_menu() {
     'page arguments'     => array('currency_form'), 
   );
 
+  // Ajax related menu items. Allow anyone access.
+  $items['currency-block-convert'] = array(
+    'title' => '',
+    'access arguments' => array('access content'),
+    'page callback' => 'currency_block_convert',
+    'type' => MENU_CALLBACK,
+  );
+  $items['currency-load-cart-total'] = array(
+    'title' => '',
+    'access arguments' => array('access content'),
+    'page callback' => 'currency_load_cart_total',
+    'type' => MENU_CALLBACK,
+  );
+  $items['currency-load-checkout-subtotal'] = array(
+    'title' => '',
+    'access arguments' => array('access content'),
+    'page callback' => 'currency_load_checkout_subtotal',
+    'type' => MENU_CALLBACK,
+  );
+
   return $items;
 }
   
@@ -60,7 +80,43 @@ function currency_admin_settings() {
     '#default_value' => variable_get('currency_description', t('You can use this form to do currency exchange.')),
     '#description'   => t('Text to display on the top of the currency form.'),
   );
-  
+
+  $form['converter_block'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Converter block settings'),
+  );
+  $form['converter_block']['currency_converter_block_from_currency'] = array(
+    '#type' => 'select',
+    '#title' => t('Force from currency'),
+    '#options' => array_merge(array('<none>' => '<none>'), currency_api_get_list()),
+    '#default_value' => variable_get('currency_converter_block_from_currency', '<none>'),
+    '#description' => t('If you select a currency, it will be the from currency for the converter block always. If you select <none> the user will be able to select the from currency on the block.'),
+  );
+  if (module_exists('uc_cart')) {
+    $form['converter_block']['ubercart'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Ubercart'),
+    );
+    $form['converter_block']['ubercart']['currency_display_convert_ubercart_cart_link'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Display option to convert users cart total'),
+      '#default_value' => variable_get('currency_display_convert_ubercart_cart_link', 0),
+      '#description' => t('If checked, the user will see an option to convert the total amount of their ubercart cart. This will convert the tax free amount if you are using taxes.'),
+    );
+    $form['converter_block']['ubercart']['currency_auto_convert_ubercart_cart'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Automatically convert the ubercart cart total on the cart page'),
+      '#default_value' => variable_get('currency_auto_convert_ubercart_cart', 0),
+      '#description' => t('If checked, when the user is on the ubercart cart page the cart total will automatically be converted in the block. This will convert the tax free amount if you are using taxes.'),
+    );
+    $form['converter_block']['ubercart']['currency_auto_convert_ubercart_checkout_subtotal'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Automatically convert the ubercart checkout subtotal on the checkout page'),
+      '#default_value' => variable_get('currency_auto_convert_ubercart_checkout_subtotal', 0),
+      '#description' => t('If checked, when the user is on the ubercart checkout page the checkout subtotal will automatically be converted in the block. The subtotal will be all the line items not including taxes.'),
+    );
+  }
+
   return system_settings_form($form);
 }  
 
@@ -68,6 +124,41 @@ function currency_perm() {
   return array('use currency');
 }
 
+/**
+ * Implementation of hook_block().
+ */
+function currency_block($op = 'list', $delta = 0, $edit = array()) {
+  switch ($op) {
+    case 'list':
+      $blocks['converter'] = array(
+        'info' => t('Currency converter'),
+        'cache' => BLOCK_CACHE_GLOBAL,
+      );
+      return $blocks;
+    case 'view':
+      switch ($delta) {
+        case 'converter':
+          $block = array(
+            'subject' => t('Currency converter'),
+            'content' => drupal_get_form('currency_convert_block_form'),
+          );
+          break;
+      } // End of delta switch
+      return $block;
+  } // End of op switch
+}
+
+/**
+ * Implementation of hook_theme().
+ */
+function currency_theme() {
+  return array(
+    'currency_convert_block_form' => array(
+      'arguments' => array('form' => NULL),
+    ),
+  );
+}
+
 function currency_form($data = array()) {
   // Get the saved data from the session, if any
   $amount = $_SESSION['currency_amount'] ? $_SESSION['currency_amount'] : 1;
@@ -149,6 +240,172 @@ function currency_form_submit($form, &$f
   drupal_set_message($result);
 }                 
 
+/**
+ * The currency conversion block form.
+ * Requires javascript to work.
+ */
+function currency_convert_block_form() {
+  currency_convert_block_add_js_css();
+
+  // This will be changed by javascript if it is enabled.
+  // It will be changed to whatever is in the currency_description variable.
+  $form['converter_description'] = array(
+    '#prefix' => '<div id="currency-convert-block-description">',
+    '#value' => t('Javascript is required to use this feature.'),
+    '#suffix' => '</div>',
+  );
+
+  $form['from'] = array(
+    '#type' => 'fieldset',
+  );
+  $form['from']['from_amount'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Amount'),
+    '#default_value' => 1,
+    '#size' => 20,
+    '#maxlength' => 9,
+    '#description' => t('Amount to convert'),
+  );
+  $form['from']['from_currency'] = array(
+    '#type' => 'select',
+    '#title' => t('Currency'),
+    '#default_value' => (variable_get('currency_converter_block_from_currency', '<none>') == '<none>') ? variable_get('currency_default_from', 'CAD') : variable_get('currency_converter_block_from_currency', '<none>'),
+    '#disabled' => !(variable_get('currency_converter_block_from_currency', '<none>') == '<none>'),
+    '#options' => currency_api_get_list(),
+  );
+  if (variable_get('currency_display_convert_ubercart_cart_link', FALSE)) {
+    $form['from']['load_cart'] = array(
+      '#value' => '<a id="currency-load-cart-total">' . t('Convert your cart total') . '</a>',
+    );
+  }
+
+  $form['equals'] = array(
+    '#value' => '<div id="currency-convert-block-equals"><img src="' . drupal_get_path('module', 'currency') . '/images/equals.png"/></div>',
+  );
+
+  $form['to'] = array(
+    '#type' => 'fieldset',
+  );
+  $form['to']['to_amount'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Amount'),
+    '#size' => 20,
+    '#maxlength' => 9,
+    '#description' => t('Amount to convert'),
+  );
+  $form['to']['to_currency'] = array(
+    '#type' => 'select',
+    '#title' => t('Currency'),
+    '#default_value' => variable_get('currency_default_to', 'USD'),
+    '#options' => currency_api_get_list(),
+  );
+
+  return $form;
+}
+
+/**
+ * Theme function for currency_convert_block_form().
+ *
+ * It does nothing but render the form but it allows
+ * people to override the themeing if they want.
+ *
+ * @ingroup themeable
+ */
+function theme_currency_convert_block_form($form) {
+  $output = drupal_render($form);
+  return $output;
+}
+
+/**
+ * Add the js and css required for the converter block.
+ */
+function currency_convert_block_add_js_css() {
+  $cart_page = arg(0) == 'cart' && !arg(1);
+  $checkout_page = arg(0) == 'cart' && arg(1) == 'checkout' && !arg(2);
+  // If the uc_payment module is not enabled we just have to do basic product calculation.
+  $checkout_calculator_url = module_exists('uc_payment') ? 'currency-load-checkout-subtotal' : 'currency-load-cart-total';
+  $js_settings['currency'] = array();
+
+  drupal_add_css(drupal_get_path('module', 'currency') . '/currency.css');
+
+  drupal_add_js(drupal_get_path('module', 'currency') . '/js/currency_convert_block.js');
+  $js_settings['currency']['blockConvertUrl'] = url('currency-block-convert', array('absolute' => TRUE));
+  $js_settings['currency']['converterDescription'] = variable_get('currency_description', t('You can use this form to do currency exchange.'));
+
+  if (variable_get('currency_display_convert_ubercart_cart_link', FALSE) || variable_get('currency_auto_convert_ubercart_cart', FALSE) || variable_get('currency_auto_convert_ubercart_checkout_subtotal', FALSE)) {
+    drupal_add_js(drupal_get_path('module', 'currency') . '/js/currency_load_cart_total.js');
+    $js_settings['currency']['cartLoadUrl'] = url('currency-load-cart-total', array('absolute' => TRUE));
+    $js_settings['currency']['checkoutLoadUrl'] = url($checkout_calculator_url, array('absolute' => TRUE));
+    $js_settings['currency']['convertCartLink'] = variable_get('currency_display_convert_ubercart_cart_link', FALSE);
+    // Only enable if we are on the cart page.
+    $js_settings['currency']['autoConvertCart'] = variable_get('currency_auto_convert_ubercart_cart', FALSE) && $cart_page;
+    // Only enable if we are on the cart page.
+    $js_settings['currency']['autoConvertCheckout'] = variable_get('currency_auto_convert_ubercart_checkout_subtotal', FALSE) && $checkout_page;
+  }
+
+  drupal_add_js($js_settings, 'setting');
+}
+
+/**
+ * Ajax callback for amount conversion.
+ */
+function currency_block_convert() {
+  $result = array('success' => FALSE);
+
+  if ($_POST['from'] && $_POST['to'] && $_POST['amount']) {
+    $ret = currency_api_convert(check_plain($_POST['from']), check_plain($_POST['to']), check_plain($_POST['amount']));
+    if ($ret['status']) {
+      $result['success'] = TRUE;
+      $result['output'] = $ret['value'];
+    }
+  }
+
+  print drupal_to_js($result);
+  exit();
+}
+
+/**
+ * Ajax callback for loading the users cart total.
+ */
+function currency_load_cart_total() {
+  $total = 0;
+  $cart = uc_cart_get_contents();
+  foreach ($cart as $item) {
+    if ($item->qty && $item->price) {
+      $total += $item->qty * $item->price;
+    }
+  }
+
+  print drupal_to_js(array('total' => $total));
+  exit();
+}
+
+/**
+ * Ajax callback for loading the users checkout subtotal (pre tax).
+ */
+function currency_load_checkout_subtotal() {
+  $total = 0;
+  $order = $_POST['order'];
+  if ($order = unserialize(rawurldecode($order))) {
+    if (is_array($order->products)) {
+      foreach ($order->products as $item) {
+        $total += $item->price * $item->qty;
+      }
+    }
+    if (is_array($order->line_items)) {
+      foreach ($order->line_items as $key => $line_item) {
+        if ($line_item['type'] == 'subtotal' || substr($line_item['type'], 0, 3) == 'tax') {
+          continue;
+        }
+        $total += $line_item['amount'];
+      }
+    }
+  }
+
+  print drupal_to_js(array('total' => $total));
+  exit();
+}
+
 // views bits
 /**
  * Implementation of hook_views().
diff -rupN currency/js/currency_convert_block.js currency_new/js/currency_convert_block.js
--- currency/js/currency_convert_block.js	1970-01-01 10:00:00.000000000 +1000
+++ js/currency_convert_block.js	2010-06-07 10:51:46.000000000 +1000
@@ -0,0 +1,59 @@
+// $Id$
+
+/**
+ * This file handles the submission of the converter block.
+ */
+
+if (Drupal.jsEnabled) {
+  $(document).ready(function() {
+    // If javascript is enabled then change the description.
+    $('#currency-convert-block-description').html(Drupal.settings.currency.converterDescription);
+
+    // Initialization.
+    currencyConvertAmount('#edit-from-amount', '#edit-to-amount');
+
+    // When the from amount is changed.
+    $('#edit-from-amount').keyup(function(event) {
+      currencyConvertAmount('#edit-from-amount', '#edit-to-amount');
+    });
+
+    // When either currency is changed.
+    $('#edit-from-currency, #edit-to-currency').change(function() {
+      currencyConvertAmount('#edit-from-amount', '#edit-to-amount');
+    });
+
+    // When the to amount is changed.
+    $('#edit-to-amount').keyup(function(event) {
+      currencyConvertAmount('#edit-to-amount', '#edit-from-amount');
+    });
+
+    // Convert the currency, given the field to get the value from and put the converted one to.
+    function currencyConvertAmount(fromID, toID) {
+      var amountVal = $(fromID).val();
+      var fromVal = $('#edit-from-currency').val();
+      var toVal = $('#edit-to-currency').val();
+
+      if (amountVal == '') {
+        $(toID).val('');
+      }
+      else if (amountVal == 0) {
+        $(toID).val(0);
+      }
+      else if (isNaN(amountVal)) {
+        $(toID).val('Error');
+      }
+      else {
+        // Call to drupal to get the converted currency.
+        $.post(Drupal.settings.currency.blockConvertUrl, {from: fromVal, to: toVal, amount: amountVal}, function(data) {
+          result = Drupal.parseJson(data);
+          if (result.success) {
+            $(toID).val(result.output);
+          }
+          else {
+            $(toID).val('Error');
+          }
+        });
+      }
+    }
+  });
+}
diff -rupN currency/js/currency_load_cart_total.js currency_new/js/currency_load_cart_total.js
--- currency/js/currency_load_cart_total.js	1970-01-01 10:00:00.000000000 +1000
+++ js/currency_load_cart_total.js	2010-06-07 16:27:17.000000000 +1000
@@ -0,0 +1,48 @@
+// $Id$
+
+/**
+ * This file handles the loading of the users ubercart totals into the from amount field.
+ */
+
+if (Drupal.jsEnabled) {
+  $(document).ready(function() {
+    // When using auto checkout convert.
+    if (Drupal.settings.currency.autoConvertCheckout == true) {
+      $('#edit-panes-payment-current-total').click(currencyGetCheckoutSubtotal);
+    }
+
+    // When using auto cart convert.
+    if (Drupal.settings.currency.autoConvertCart == true) {
+      currencyGetCartTotal();
+    }
+
+    // When convert your cart link is clicked.
+    if (Drupal.settings.currency.convertCartLink == true) {
+      $('#currency-load-cart-total').click(currencyGetCartTotal);
+    }
+  });
+
+  function currencyGetCartTotal() {
+    $.post(Drupal.settings.currency.cartLoadUrl, function(data) {
+      var result = Drupal.parseJson(data);
+      $('#edit-from-amount').val(result.total);
+      $('#edit-from-amount').keyup();
+    });
+  }
+
+  function currencyGetCheckoutSubtotal() {
+    var orderArray = '';
+    // This is in uc_payment.js so check that it exists
+    if (typeof serializeOrder == 'function') {
+      orderArray = serializeOrder();
+      orderArray = Drupal.encodeURIComponent(orderArray);
+    }
+
+    // checkoutLoadUrl will be different depending on whether or not uc_payment is enabled.
+    $.post(Drupal.settings.currency.checkoutLoadUrl, {order:orderArray}, function(data) {
+      var result = Drupal.parseJson(data);
+      $('#edit-from-amount').val(result.total);
+      $('#edit-from-amount').keyup();
+    });
+  }
+}
