// $Id$

Drupal.behaviors = Drupal.behaviors || {};

/**
 * This function looks for swfobject class items and loads them
 * as swfobjects.
 */
Drupal.behaviors.SWFObject = function(context) {
  // get each swf div that needs to be processed
  $('.swfobject:not(.swfobjectInit-processed)', context).each(function () {     
    var config = Drupal.settings.swfobject_api['files'][$(this).attr('id')];
    swfobject.embedSWF(config.url, $(this).attr('id'), config.width, config.height, config.version, config.express_redirect, config.flashVars, config.params, config.attributes);
    // set this item to processed
    $(this).addClass('swfobjectInit-processed');
  });
}

$(document).ready( function () {
  Drupal.behaviors.SWFObject(document);
});

