Index: image_caption.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image_caption/image_caption.js,v
retrieving revision 1.2.2.3
diff -u -r1.2.2.3 image_caption.js
--- image_caption.js	3 Feb 2010 07:50:25 -0000	1.2.2.3
+++ image_caption.js	11 Feb 2010 18:37:22 -0000
@@ -5,13 +5,23 @@
     var imgheight = $(this).height();
     var captiontext = $(this).attr('title');
     var style = $(this).attr('style');
+    // If the image's style is undefined, then an empty string is better.
+    if (style == undefined) {
+      style = '';
+    } else {
+      style += '; ';
+    }
     var alignment = $(this).attr('align');
-    //Clear image styles to prevent conflicts with parent div
+    // If the image's align property is not set, then get the image's css float property
+    if (!alignment) {
+      alignment = $(this).css('float');
+    }
+    // Clear image styles to prevent conflicts with parent div
     $(this).attr({align:""});
     $(this).attr({style:""});
-    $(this).wrap("<span class=\"image-caption-container\" style=\"display:block;" + style + "; float: " + alignment + "\"></span>");
+    $(this).wrap("<span class=\"image-caption-container\" style=\"display:block; " + style + "float:" + alignment + "\"></span>");
     $(this).parent().addClass('image-caption-container-' + alignment);
-    if(imgwidth != 'undefined' && imgwidth != 0){
+    if(imgwidth != undefined && imgwidth != 0){
       $(this).parent().width(imgwidth);
     }
     $(this).parent().append("<span style=\"display:block;\" class=\"image-caption\">" + captiontext + "</span>");

