=== modified file 'uc_product/uc_product.admin.inc'
--- uc_product/uc_product.admin.inc	2008-12-17 08:40:03 +0000
+++ uc_product/uc_product.admin.inc	2008-12-21 06:48:19 +0000
@@ -42,6 +42,27 @@
 }
 
 /**
+ * Display a list of image widgets, and allow the user to select one.
+ */
+function uc_product_image_widgets() {
+  $widgets = module_invoke_all('uc_image_widget');
+  
+  foreach ($widgets as $key => $widget) {
+    $options[$key] = $widget['name'];
+  }
+  $options[NULL] = 'None';
+  
+  $form['uc_product_image_widget'] = array(
+    '#type' => 'radios',
+    '#title' => t('Image widget to use when a customer clicks on a product image'),
+    '#options' => $options,
+    '#default_value' => variable_get('uc_product_image_widget', NULL),
+  );
+  
+  return system_settings_form($form);
+}
+
+/**
  * Display a list of product classes.
  */
 function uc_product_class_default() {

=== modified file 'uc_product/uc_product.module'
--- uc_product/uc_product.module	2008-12-17 08:40:03 +0000
+++ uc_product/uc_product.module	2008-12-21 06:50:40 +0000
@@ -95,6 +95,17 @@
     'type' => MENU_LOCAL_TASK,
     'file' => 'uc_product.admin.inc',
   );
+  $items['admin/store/settings/products/edit/image-widgets'] = array(
+    'title' => 'Product images',
+    'description' => 'Choose and enable an existing image widget.',
+    'access arguments' => array('administer products'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('uc_product_image_widgets'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 1,
+    'file' => 'uc_product.admin.inc',
+  );
+  
   // Insert subitems into the edit node page for product types.
   $items['node/%node/edit/product'] = array(
     'title' => 'Product',
@@ -1426,26 +1437,30 @@
  */
 function theme_uc_product_image($images) {
   static $rel_count = 0;
-  $thickbox_enabled = module_exists('thickbox');
+  
+  // Get the current product image widget.
+  $image_widget = uc_product_get_image_widget();
+  $image_widget_func = $image_widget['callback'];
+  
   $first = array_shift($images);
   $output = '<div class="product_image">';
-  if ($thickbox_enabled) {
-    $output .= '<a href="'. check_url(file_create_url($first['filepath'])) .'" title="'. $first['title'] .'" class="thickbox" rel="field_image_cache_'. $rel_count .'">';
+  if ($image_widget) {
+    $output .= '<a href="'. check_url(file_create_url($first['filepath'])) .'" title="'. $first['title'] .'"'. $image_widget_func($rel_count) .'>';
   }
   $output .= theme('imagecache', 'product', $first['filepath'], $first['alt'], $first['title']);
   /* if (count($images)) {
     $output .= '<br />'. t('Click for more images.');
   } */
-  if ($thickbox_enabled) {
+  if ($image_widget) {
     $output .= '</a>';
   }
   $output .= '<br />';
   foreach ($images as $thumbnail) {
-    if ($thickbox_enabled) {
-      $output .= '<a href="'. check_url(file_create_url($thumbnail['filepath'])) .'" title="'. $thumbnail['title'] .'" class="thickbox" rel="field_image_cache_'. $rel_count .'">';
+    if ($image_widget) {
+      $output .= '<a href="'. check_url(file_create_url($thumbnail['filepath'])) .'" title="'. $thumbnail['title'] .'"'. $image_widget_func($rel_count) .'>';
     }
     $output .= theme('imagecache', 'uc_thumbnail', $thumbnail['filepath'], $thumbnail['alt'], $thumbnail['title']);
-    if ($thickbox_enabled) {
+    if ($image_widget) {
       $output .= '</a>';
     }
   }
@@ -1518,22 +1533,49 @@
  *   When $format is 'preview', the image is a link to the image file.
  */
 function uc_product_get_picture($node_id, $format = 'product') {
-  $img = '';
+  static $image_widget;
+  
+  $output = '';
   $product = node_load($node_id);
+  
   if (!module_exists('imagecache')) {
     return '';
   }
+  
+  // Get the current product image widget.
+  $image_widget = uc_product_get_image_widget();
+  $image_widget_func = $image_widget['callback'];
+  
   $path = $product->field_image_cache[0]['filepath'];
   if (file_exists($path)) {
     $img = theme('imagecache', $format, $path, $product->field_image_cache[0]['alt'], $product->field_image_cache[0]['title']);
     if ($format == 'product') {
-      $img = '<a href="'. check_url(file_create_url($path)) .'" class="thickbox" rel="field_image_cache">'. $img .'</a>';
+      if ($image_widget) {
+        $output .= '<a title="'. $product->field_image_cache[0]['title'] .'" href="'. check_url(file_create_url($path)) .'" '. $image_widget_func(NULL) .'>';
+      }
+      $output .= $img;
+      if ($image_widget) {
+        $output .= '</a>';
+      }
     }
     else {
-      $img = l($img, 'node/'. $product->nid, array('html' => TRUE));
+      $output = l($img, 'node/'. $product->nid, array('html' => TRUE));
     }
   }
-  return $img;
+  return $output;
+}
+
+function uc_product_get_image_widget() {
+  static $got_widget = FALSE, $image_widget = array();
+  
+  // Get the current image widget. (if any)
+  if (!$got_widget) {
+    $image_widgets = uc_store_get_image_widgets();
+    $image_widget = $image_widgets[variable_get('uc_product_image_widget', NULL)];
+    $got_widget = TRUE;
+  }
+  
+  return $image_widget;
 }
 
 /**

=== modified file 'uc_store/uc_store.module'
--- uc_store/uc_store.module	2008-12-17 08:40:03 +0000
+++ uc_store/uc_store.module	2008-12-22 16:49:35 +0000
@@ -1833,3 +1833,58 @@
   return '2.0-beta1';
 }
 
+/**
+ * Get image widgets defined by various modules. (including the built-in thickbox & lightbox2 support)
+ */
+function uc_store_get_image_widgets() {
+  return module_invoke_all('uc_image_widget');
+}
+
+/**
+ * Built-in support for thickbox and lightbox2.
+ */
+function uc_store_uc_image_widget() {
+  $widgets = array();
+  
+  if (module_exists('thickbox')) {
+    $widgets['thickbox'] = array(
+      'name' => t('Thickbox'),
+      'callback' => 'uc_store_image_widget_thickbox',
+    );
+  }
+  if (module_exists('lightbox2')) {
+    $widgets['lightbox2'] = array(
+      'name' => t('Lightbox2'),
+      'callback' => 'uc_store_image_widget_lightbox2',
+    );
+  }
+  
+  return $widgets;
+}
+
+/**
+ * This function generates the thickbox-specific HTML attributes.
+ */
+function uc_store_image_widget_thickbox($rel_count) {
+  if (!is_null($rel_count)) {
+    $img_index = 'field_image_cache_'. $rel_count;
+  }
+  else {
+    $img_index = 'field_image_cache';
+  }
+  return 'class="thickbox" rel="'. $img_index .'"';
+}
+
+/**
+ * This function generates the lightbox2-specific HTML attributes.
+ */
+function uc_store_image_widget_lightbox2($rel_count) {
+  if (!is_null($rel_count)) {
+    $img_index = 'lightbox['. $rel_count .']';
+  }
+  else {
+    $img_index = 'lightbox';
+  }
+  return 'rel="'. $img_index .'"';
+}
+

