Index: viewscarousel.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/viewscarousel/viewscarousel.module,v
retrieving revision 1.8.2.1
diff -u -r1.8.2.1 viewscarousel.module
--- viewscarousel.module	7 Apr 2009 17:09:32 -0000	1.8.2.1
+++ viewscarousel.module	10 Nov 2009 21:14:01 -0000
@@ -31,6 +31,21 @@
     }
   }
 
+  // Check if 'Node aware start' is activated and if we're viewing a node.
+  if ($options['nodeaware'] && arg(0) == 'node' && is_numeric(arg(1))) {
+    // Go through the items in the views.
+    foreach ($view->result as $object => $key) {
+      // Find a node-id item corresponding to the current node-id. 
+      if ($key->nid == arg(1)) {
+        // Override start and offset values using the found item's index.
+        $options[start] = ((int)$object + 1) - $options['nodeaware_offset'];
+        $options[offset] = -($options[start]);
+      }
+    }
+  }
+  // Remove nodeaware and nodeaware_offset from the options (not useful for jcarousel).
+  unset($options['nodeaware'], $options['nodeaware_offset']);
+
   // Use jCarousel to create the carousel.
   return theme('jcarousel', $rows, $options, $skin, $path, 'viewscarousel-'. $view->name .'-'. $view->current_display);
 }
Index: viewscarousel_style_plugin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/viewscarousel/viewscarousel_style_plugin.inc,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 viewscarousel_style_plugin.inc
--- viewscarousel_style_plugin.inc	5 Nov 2009 20:29:50 -0000	1.2.2.2
+++ viewscarousel_style_plugin.inc	10 Nov 2009 21:13:59 -0000
@@ -16,6 +16,8 @@
     $options['vertical'] = array('default' => FALSE);
     $options['start'] = array('default' => '');
     $options['offset'] = array('default' => '');
+    $options['nodeaware'] = array('default' => FALSE);
+    $options['nodeaware_offset'] = array('default' => 0);
     $options['scroll'] = array('default' => '');
     $options['visible'] = array('default' => NULL);
     $options['animation'] = array('default' => 'fast');
@@ -63,6 +65,22 @@
       '#maxlength' => 4,
       '#default_value' => $this->options['offset'],
     );
+    $form['nodeaware'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Node aware start index'),
+      '#description' => t('When activated, if one of the items corresponds to the currently viewed node, this item would be used as the start position of the carousel and defined as the jcarousel-item-0. In that case, manual start and offset values will be overridden.'),
+      '#default_value' => $this->options['nodeaware'],
+    );
+    $form['nodeaware_offset'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Display offset'),
+      '#description' => t('Display position in the carousel, starting with 0.'),
+      '#size' => 4,
+      '#maxlength' => 4,
+      '#default_value' => $this->options['nodeaware_offset'],
+      '#process' => array('views_process_dependency'),
+      '#dependency' => array('edit-style-options-nodeaware' => array(TRUE)),
+    );
     $form['scroll'] = array(
       '#type' => 'textfield',
       '#title' => t('Scroll'),

