diff -rupN uc_option_image/uc_option_image.info /Users/sundar/Sites/d6/sites/all/modules/ubercart/uc_option_image/uc_option_image.info
--- uc_option_image/uc_option_image.info	2009-04-20 23:06:07.000000000 -0500
+++ /Users/sundar/Sites/d6/sites/all/modules/ubercart/uc_option_image/uc_option_image.info	2009-07-04 02:22:03.000000000 -0500
@@ -6,8 +6,8 @@ package = "Ubercart - core (optional)"
 core = 6.x
 
 ; Information added by drupal.org packaging script on 2009-04-21
-version = "6.x-1.4"
+version = "6.x-1.5"
 core = "6.x"
 project = "uc_option_image"
-datestamp = "1240286767"
+datestamp = "1246692061"
 
diff -rupN uc_option_image/uc_option_image.install /Users/sundar/Sites/d6/sites/all/modules/ubercart/uc_option_image/uc_option_image.install
--- uc_option_image/uc_option_image.install	2009-04-20 22:59:52.000000000 -0500
+++ /Users/sundar/Sites/d6/sites/all/modules/ubercart/uc_option_image/uc_option_image.install	2009-05-03 21:08:04.000000000 -0500
@@ -8,7 +8,7 @@ function uc_option_image_install($no_ima
   if ($info) {
     $file = (object) array(
       'uid' => 1,
-      'filename' => 'option_image_0_0_0';
+      'filename' => 'option_image_0_0_0',
       'filepath' => $no_image,
       'filemime' => $info['file_mime'],
       'filesize' => $info['file_size'],
diff -rupN uc_option_image/uc_option_image.js /Users/sundar/Sites/d6/sites/all/modules/ubercart/uc_option_image/uc_option_image.js
--- uc_option_image/uc_option_image.js	2009-04-14 13:59:30.000000000 -0500
+++ /Users/sundar/Sites/d6/sites/all/modules/ubercart/uc_option_image/uc_option_image.js	2009-05-05 09:13:17.000000000 -0500
@@ -34,7 +34,8 @@ UCOI.switchImage = function(aid, input, 
   var pid = $(input).parents('.node').attr('id');
   var nid = pid.replace('node-', '');             
   var oid = $(input).val(); 
-  var image = $(input).parents('.content').children('img.uc-option-image');       
+  // var image = $(input).parents('.content').children('img.uc-option-image'); 
+  var image = $(input).parents('.content').find('img.uc-option-image'); 
           
   // Make sure we have permission to switch this attribute
   if (this.attributes[aid] === 0){
@@ -81,4 +82,4 @@ if (Drupal.jsEnabled) {
   $(function(){
     UCOI.init();
   });
-}
\ No newline at end of file
+}
diff -rupN uc_option_image/uc_option_image.module /Users/sundar/Sites/d6/sites/all/modules/ubercart/uc_option_image/uc_option_image.module
--- uc_option_image/uc_option_image.module	2009-04-16 14:26:50.000000000 -0500
+++ /Users/sundar/Sites/d6/sites/all/modules/ubercart/uc_option_image/uc_option_image.module	2009-07-04 16:26:39.000000000 -0500
@@ -27,6 +27,7 @@ function uc_option_image_perm(){
 
 /**
  * Implementation of hook_nodeapi().
+ * a3 = teaser, a4 = page
  */
 function uc_option_image_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
   switch ($op) {
@@ -39,19 +40,31 @@ function uc_option_image_nodeapi(&$node,
        
       if (count($node->attributes)) {
         $page_size = variable_get('uc_option_image_page_size', 'preview');     
+
         foreach($node->attributes AS $attribute) {
           if (count($attribute->options)) {
-            foreach($attribute->options AS $option) {
-              $file = uc_option_image_load($node->nid, $attribute->aid, $option->oid);
-              if ($file && $file->filepath) {
-                $node->option_images[] = $file;
-                // Load imagecached option images
-                if ($page_size != '_original') {
-                  $node->option_images_cached[$option->oid] = imagecache_create_url($page_size, $file->filepath);
-                }
-                else {
-                  $node->option_images_cached[$option->oid] = $file->filepath;
-                }
+            // Limit the option images displayed to those with a stock value
+            $result = db_query("SELECT a.combination AS combination, s.stock AS stock FROM {uc_product_adjustments} a, {uc_product_stock} s WHERE a.nid = %d AND s.sku = a.model AND s.active = 1", $node->nid);
+            // This builds an array where each option is a key 
+            //  containing its available combinations as elements 
+            $available = array();
+            while ($data = db_fetch_object($result)) {
+              $combo = unserialize($data->combination); 
+              if ($data->stock > 0) { // Stock is available
+                foreach ($combo as $key => $oid) { // Grab possible combinations
+                  // print_r($oid); print_r( "<br/>");
+                  $file = uc_option_image_load($node->nid, $attribute->aid, $oid);
+                  if ($file && $file->filepath) {
+                    $node->option_images[] = $file;
+                    // Load imagecached option images
+                    if ($page_size != '_original') {
+                      $node->option_images_cached[$oid] = imagecache_create_url($page_size, $file->filepath);
+                    }
+                    else {
+                      $node->option_images_cached[$oid] = $file->filepath;
+                    }
+                  }
+                } 
               }
             }
           }           
@@ -140,7 +153,7 @@ function uc_option_image_form_alter(&$fo
             foreach($oids AS $oid) { 
               $file = uc_option_image_load($nid, $aid, $oid);
               
-              if (!empty($file)) {
+              // if (!empty($file)) { // Why do this?
                 $form['attributes'][$aid]['options'][$oid]['option_image_preview'] = array(
                   '#type' => 'markup',                       
                   '#value' => theme('uc_option_image', $file, variable_get('uc_option_image_preview_size', '_original')),       
@@ -152,7 +165,7 @@ function uc_option_image_form_alter(&$fo
                   '#size' => 8,
                   '#default_value' => $file->filename,       
                 );
-              }
+              // } 
             }
           } 
         } 
@@ -394,6 +407,7 @@ function uc_option_image($node, $attribu
 function uc_option_image_load($nid, $aid, $oid) {
   static $files;
   $filename = uc_option_image_id($nid, $aid, $oid);
+
   if (empty($files[$filename])){
     $files[$filename] = db_fetch_object(db_query("SELECT * FROM {files} WHERE filename = '%s'", $filename));
     if (empty($files[$filename])) {
@@ -629,9 +643,9 @@ function theme_uc_option_image_preloaded
  */
 function theme_uc_option_image_no_image($node, $size = '_original') {
   $attributes = array('class' => 'uc-option-image');
-  $filename = path_to_theme() . '/images/noimage.png';
+  $filename = file_directory_path() . '/option-images/no_image.png';
   
-  if ($size != '_original'){           
+  if ($size != '_original'){ 
     return theme('imagecache', $size, $filename, t('No Image'), NULL, $attributes);
   }
   else {                                                        
@@ -643,7 +657,7 @@ function theme_uc_option_image_no_image(
  * Theme the no image placeholder. Must be a valid imagepath.
  */
 function theme_uc_option_image_no_image_path($node, $size = '_original') {
-  $filename = path_to_theme() . '/images/noimage.png';
+  $filename = file_directory_path() . '/option-images/no_image.png';
   
   if ($size != '_original'){           
     return imagecache_create_url($size, $filename);
