diff --git a/jquery.swfembed.js b/jquery.swfembed.js
index be5158e..54672ef 100755
--- a/jquery.swfembed.js
+++ b/jquery.swfembed.js
@@ -30,7 +30,7 @@
   $.fn.swfEmbed = function (swfObject) {
     
     var opts = (arguments.length > 1) ? $.extend({}, $.fn.swfEmbed.defaults, arguments[1]) : $.fn.swfEmbed.defaults;
-    
+
     if (!flashEnabled()) {
       // No flash. We assume the coder was nice enough to include 
       // a default... something
@@ -38,6 +38,14 @@
     }
     
     if (opts.version && !checkFlashVersion(opts.version)) {
+      var i=0;
+      while(i<opts.fallbackSwfs.length) {
+          if(checkFlashVersion(opts.fallbackSwfs[i].version)) {
+              embedObject(opts.fallbackSwfs[i].file);
+              return this;
+          }
+          i++;
+      }
       if (opts.expressInstall == null)
         expressInstall(opts, this);
       return this;
@@ -52,11 +60,13 @@
    * is to pass in an options object in $().swfEmbed().
    */
   $.fn.swfEmbed.defaults = {
+    id: 'swfembed_swf_1',
     width: 1,
     height: 1,
     mimeType: "application/x-shockwave-flash",
     params: {},
     flashvars: {},
+    fallbackSwfs: [],
     version: null,
     expressInstall: null,
     pluginspage: "http://www.adobe.com/go/getflashplayer"
@@ -85,6 +95,7 @@
       }
       
       // Set attributes
+      obj += ' id="'+ opts.id +'"';
       obj += ' width="'+ opts.width +'"';
       obj += ' height="'+ opts.height +'"';
       
@@ -221,4 +232,4 @@
       embedObject(options.expressInstall, opts, jq);
     }
   };
-})(jQuery);
\ No newline at end of file
+})(jQuery);
diff --git a/swfembed.module b/swfembed.module
index 5a26323..e2f6687 100755
--- a/swfembed.module
+++ b/swfembed.module
@@ -36,8 +36,7 @@ function swfembed_add_js() {
 function swfembed_theme($existing, $type, $theme, $path) {
   return array(
     'swfembed_embed' => array(
-      //'function' => 'theme_swfembed_embed',
-      'arguments' => array('swf_object' => NULL),
+      'variables' => array('swf_object' => NULL),
     ),
   );
 }
@@ -48,17 +47,15 @@ function swfembed_theme($existing, $type, $theme, $path) {
  * @param $swf_object
  *   An SWFObject object.
  */
-function theme_swfembed_embed(SWFObject $swf_object) {
-  static $id_counter = 1;
-
+function theme_swfembed_embed($variables) {
+  $swf_object = $variables['swf'];
+  
   swfembed_add_js();
 
-  // We use an underscore so that this can be accessed as an object
-  // property in JS.
-  $id = 'swf_' . $id_counter++;
+  $id = $swf_object->getId();
 
   $settings['swfembed']['swf'][$id] = $swf_object->toArray();
-  drupal_add_js($settings, 'setting');
+  drupal_add_js($settings, array('type'=>'setting'));
 
   return '<div id="' . $id . '">' . $swf_object->getNoFlash() . '</div>';
 }
@@ -145,6 +142,7 @@ class SWFObject {
     'width' => NULL,
   );
 
+  protected $swfFallbacks=array();
 
   /**
    * The path to the flash object.
@@ -168,6 +166,13 @@ class SWFObject {
   protected $minimumVersion = '';
 
   /**
+   * The id of the div for including the flash div
+   *
+   * @var string
+   */
+  protected $id='';
+  
+  /**
    * Constructor
    *
    * @param $flash_object
@@ -175,8 +180,18 @@ class SWFObject {
    */
   function __construct($flash_object) {
     $this->flashObject = $flash_object;
-  }
+    $id_counter=&drupal_static('swfembed_id_counter',1);
 
+     // We use an underscore so that this can be accessed as an object
+    // property in JS.
+    $this->id='swf_' . $id_counter++;
+  }
+  /**
+   * Get the id for the div
+   */
+  function getId() {
+      return $this->id;
+  }
   /**
    * Get the flash object file path.
    */
@@ -417,7 +432,7 @@ class SWFObject {
     $this->minimumVersion = $version;
     return $this;
   }
-
+  
   /**
    * Get the minimum Flash player version.
    *
@@ -427,6 +442,25 @@ class SWFObject {
   public function getMinimumVersion() {
     return $this->minimumVersion;
   }
+  /**
+   * Sets additional SWF files to use if we don't we have the minimum version of flash
+   *
+   * @param $version
+   * @param $file 
+   * @return The called object
+   */
+  public function swfFallback($version,$file) {
+      $this->swfFallbacks[] = array('file'=>$file,'version'=>$version);
+      return $this;
+  }
+  /**
+   * Gets the fallback swf array
+   *
+   * @return The array of fallback swf information 
+   */
+  public function getSwfFallbacks() {
+      return $this->swfFallbacks;
+  }
 
   /**
    * Convert this to an array ready for serializing.
@@ -438,12 +472,14 @@ class SWFObject {
    */
   public function toArray() {
     return array(
+      'id' => "swfembed_" . $this->getId(),
       'height' => $this->getHeight(),
       'width' => $this->getWidth(),
       'flashvars' => $this->getFlashVars(),
       'params' => $this->getParams(),
-      //'noflash' => $this->getNoFlash(),
+      'noflash' => $this->getNoFlash(),
       'url' => $this->getFlashObject(),
+      'swfFallbacks' => $this->getSwfFallbacks(),
       'expressInstall' => $this->getExpressRedirectURL(),
       'version' => $this->getMinimumVersion(),
     );
@@ -459,7 +495,7 @@ class SWFObject {
    * @return unknown
    */
   public function render() {
-    return theme('swfembed_embed', $this);
+    return theme('swfembed_embed', array('swf' => $this));
   }
 
-}
\ No newline at end of file
+}
