Index: galleria.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/galleria/Attic/galleria.admin.inc,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 galleria.admin.inc
--- galleria.admin.inc	27 Apr 2009 16:02:11 -0000	1.1.2.6
+++ galleria.admin.inc	3 May 2009 03:48:20 -0000
@@ -60,6 +60,71 @@ function galleria_admin_settings() {
     drupal_set_message(t('If you install the imagecache module, you will get extra options here for integration.'), 'status');
   }
 
+  // jCarousel integration settings
+  if (module_exists('jcarousel')) {
+    $form['galleria_jcarousel'] = array('#type' => 'fieldset', '#title' => t('jCarousel Integration'));
+    
+    $form['galleria_jcarousel']['galleria_jcarousel'] = array(
+      '#type' => 'select',
+      '#title' => t('jCarousel Integration'),
+      '#options' => array(
+        'enabled' => 'Enabled',
+        'disabled' => 'Disabled',
+      ),
+      '#default_value' => variable_get('galleria_jcarousel', 'enabled'),
+    );
+    
+    $form['galleria_jcarousel']['galleria_jcarousel_vertical'] = array(
+      '#type' => 'select',
+      '#title' => t('Orientation'),
+      '#options' => array(
+        'false' => 'Horizontal',
+        'true' => 'Vertical',
+      ),
+      '#default_value' => variable_get('galleria_jcarousel_vertical', 'false'),
+    );
+    
+    $form['galleria_jcarousel']['galleria_jcarousel_visible'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Limit of visible thumbnails'),
+      '#size' => 15,
+      '#default_value' => variable_get('galleria_jcarousel_visible', '3'),
+      '#description' => t('Thumbnails will be cropped so exactly this number of thumbnails is always shown. Must be an integer greater than zero.'),
+    );
+    
+    $form['galleria_jcarousel']['galleria_jcarousel_scroll'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Scroll size'),
+      '#size' => 15,
+      '#default_value' => variable_get('galleria_jcarousel_scroll', '3'),
+      '#description' => t('The number of thumbnails to scroll with each mouse click.'),
+    );
+    
+    $form['galleria_jcarousel']['galleria_jcarousel_animation'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Animation speed'),
+      '#size' => 15,
+      '#default_value' => variable_get('galleria_jcarousel_animation', 'fast'),
+      '#description' => t('The speed of the scroll animation. Use "slow", "normal", "fast", or the number of milliseconds (ie. "100"). If set to 0, animation is turned off.'),
+    );
+    
+    $form['galleria_jcarousel']['galleria_jcarousel_wrap'] = array(
+      '#type' => 'select',
+      '#title' => t('Wrap'),
+      '#options' => array(
+        'null' => 'None',
+        'left' => 'Left',
+        'right' => 'Right',
+        'both' => 'Both',
+      ),
+      '#default_value' => variable_get('galleria_jcarousel_wrap', 'null'),
+      '#description' => t('Specifies whether to wrap at the first/last item (or both) and jump back to the start/end.'),
+    );
+  }
+  else {
+    drupal_set_message(t('If you install the jCarousel module, you will get extra options here for integration.'), 'status');
+  }
+
   $form['galleria_show_page_warning'] = array(
     '#type' => 'checkbox',
     '#title' => t('Galleria warnings'),
@@ -69,3 +134,42 @@ function galleria_admin_settings() {
 
   return system_settings_form($form);
 }
+
+function galleria_admin_settings_validate($form, &$form_state) {
+  if (module_exists('jcarousel')) {
+    $input_names = array(
+      'visible' => 'Limit of visible thumbnails',
+      'scroll' => 'Scroll size',
+    );
+    foreach($input_names as $name => $title) {
+      $value =& $form_state['values']['galleria_jcarousel_' . $name];
+      if (!is_numeric($value)) {
+        form_set_error('galleria_jcarousel_' . $name, t('"' . $title . '" must be an integer.'));
+      }
+      else {
+        $value = intval($value);
+      } 
+    }
+
+    //The "visible" setting cannot be 0, otherwise the carousel explodes in IE
+    if ($form_state['values']['galleria_jcarousel_visible'] == 0) {
+      form_set_error('galleria_jcarousel_visible', t('"Limit of visible thumbnails" must be greater than zero.'));
+    }
+
+    $animation =& $form_state['values']['galleria_jcarousel_animation'];
+    switch($animation) {
+      case 'slow':
+      case 'normal':
+      case 'fast':
+      break;
+      default:
+        if (!is_numeric($animation)) {
+          form_set_error('galleria_jcarousel_animation', t('"Animation speed" must be "slow", "normal", "fast", or an integer value.'));
+        }
+        else {
+          $animation = intval($animation);
+        } 
+      break;
+    }
+  }
+}
Index: galleria.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/galleria/Attic/galleria.install,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 galleria.install
--- galleria.install	28 Apr 2009 09:08:40 -0000	1.1.2.5
+++ galleria.install	3 May 2009 03:42:25 -0000
@@ -14,6 +14,13 @@ function galleria_uninstall() {
   variable_del('galleria_show_page_warning');
   variable_del('galleria_imagecache_preset');
   variable_del('galleria_thumb_imagecache_preset');
+  variable_del('galleria_thumb_location');
+  variable_del('galleria_jcarousel');
+  variable_del('galleria_jcarousel_vertical');
+  variable_del('galleria_jcarousel_visible');
+  variable_del('galleria_jcarousel_scroll');
+  variable_del('galleria_jcarousel_animation');
+  variable_del('galleria_jcarousel_wrap');
   $node_types = node_get_types('names');
   foreach ($node_types as $type) {
     variable_del("galleria_$type");
Index: galleria.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/galleria/galleria.module,v
retrieving revision 1.1.2.20
diff -u -p -r1.1.2.20 galleria.module
--- galleria.module	29 Apr 2009 09:59:13 -0000	1.1.2.20
+++ galleria.module	3 May 2009 03:18:24 -0000
@@ -334,6 +334,19 @@ function template_preprocess_galleria(&$
   }
 
   $vars['next_prev_links'] = ($i > 1) ? '<a onclick="$.galleria.prev(); return false;" href="#"><< ' . t('previous') . '</a> | <a onclick="$.galleria.next(); return false;" href="#">' . t('next') . '>></a>' : '';
+
+  // jCarousel integration setup
+  if (module_exists('jcarousel') && variable_get('galleria_jcarousel', 'enabled') == 'enabled') {
+    $options = array(
+      'vertical' => (variable_get('galleria_jcarousel_vertical', 'false') == 'true') ? TRUE : FALSE,
+      'visible' => variable_get('galleria_jcarousel_visible', '3'),
+      'scroll' => variable_get('galleria_jcarousel_scroll', '3'),
+      'animation' => variable_get('galleria_jcarousel_animation', 'fast'),
+      'wrap' => variable_get('galleria_jcarousel_wrap', 'null'),
+      'initCallback' => 'jcarousel_initCallback',
+    );
+    jcarousel_add('.gallery', $options);
+  }
 }
 
 /**
cvs diff: Diffing inc
Index: inc/galleria.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/galleria/inc/galleria.js,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 galleria.js
--- inc/galleria.js	27 Apr 2009 16:02:11 -0000	1.1.2.6
+++ inc/galleria.js	3 May 2009 03:20:23 -0000
@@ -30,6 +30,9 @@ var options = {
       image.attr('title','Next image >>');
 
       $('.galleria-nav').show();
+
+      // trigger the jCarousel to scroll to the current image's thumbnail
+      $('#main-image').trigger('img_change', [thumb.parent().attr('jcarouselindex')]);
     }
   },
 
@@ -67,3 +70,11 @@ Drupal.behaviors.initGalleria = function
     }
   });
 };
+
+function jcarousel_initCallback(carousel) {
+  jQuery('#main-image').bind('img_change', function(e, index) {
+    var num = parseInt(index);
+    carousel.scroll(num);
+    return false;
+  });
+};
