diff --git a/lightbox2.module b/lightbox2.module
index 14e1c7e..5fb1a64 100644
--- a/lightbox2.module
+++ b/lightbox2.module
@@ -760,40 +760,59 @@ function lightbox2_add_files() {
     $js_settings['download_link_text'] = check_plain(variable_get('lightbox2_download_link_text', 'Download Original'));
   }
 
+  // Allow other modules to modify settings.
+  drupal_alter('lightbox2_js_settings', $js_settings);
   drupal_add_js(array('lightbox2' => $js_settings), array( 'type' => 'setting' ) );
 
 
   // Check where we should load the javascript files - header or footer.
   $js_location = variable_get('lightbox2_js_location', 'header');
 
+  $css_list = array();
+  $js_list = array();
+
   // Lightbox2 Plus.
   if (!variable_get('lightbox2_lite', FALSE)) {
     $css = $path . '/css/lightbox.css';
     if (variable_get('lightbox2_use_alt_layout', FALSE)) {
       $css = $path . '/css/lightbox_alt.css';
     }
-    drupal_add_css($css);
+    $css_list['lightbox'] = array('path' => $css, 'options' => array());
 
     // Check to see if any automatic image handling options are enabled.
     if ($image_node_handler || $flickr_image_handler || $gallery2_block_handler || $inline_image_handler || $image_assist_handler || $custom_triggers != '') {
-      drupal_add_js($path . '/js/auto_image_handling.js', array( 'scope' => $js_location ) );
+      $js_list['auto_image_handling'] = array('path' => $path . '/js/auto_image_handling.js', 'options' => array( 'scope' => $js_location ));
     }
     if (variable_get('lightbox2_enable_video', FALSE)) {
-      drupal_add_js($path . '/js/lightbox_video.js', array( 'scope' => $js_location ) );
+      $js_list['lightbox_video'] = array('path' => $path . '/js/lightbox_video.js', 'options' => array( 'scope' => $js_location ));
     }
     if ($enable_login || $enable_contact) {
-      drupal_add_js($path . '/js/lightbox_modal.js', array( 'scope' => $js_location ) );
+      $js_list['lightbox_modal'] = array('path' => $path . '/js/lightbox_modal.js', 'options' => array( 'scope' => $js_location ));
     }
     //drupal_add_js($path .'/js/prototype.js', array( 'scope' => $js_location, 'cache' => false ) );
     //drupal_add_js($path .'/js/scriptaculous.js', array( 'scope' => $js_location, 'cache' => false ) );
-    drupal_add_js($path . '/js/lightbox.js', array( 'scope' => $js_location , 'cache' => FALSE) );
+    $js_list['lightbox'] = array('path' => $path . '/js/lightbox.js', 'options' => array( 'scope' => $js_location , 'cache' => FALSE));
 
   }
   // Lightbox Lite.
   else {
     $css = $path . '/css/lightbox_lite.css';
-    drupal_add_css($css);
-    drupal_add_js($path . '/js/lightbox_lite.js', array( 'scope' => $js_location ) );
+    $css_list['lightbox'] = array('path' => $css, 'options' => array());
+    $js_list['lightbox_lite'] = array('path' => $path . '/js/lightbox_lite.js', 'options' => array( 'scope' => $js_location ));
+  }
+
+  // Allow other modules to use custom css and js files.
+  drupal_alter('lightbox2_css_list', $css_list);
+  drupal_alter('lightbox2_js_list', $js_list);
+
+  // Add lightbox JS files.
+  foreach ($js_list as $js) {
+    drupal_add_js($js['path'], (isset($js['options'])) ? $js['options'] : array());
+  }
+
+  // Add lightbox CSS files.
+  foreach ($css_list as $css) {
+    drupal_add_css($css['path'], (isset($css['options'])) ? $css['options'] : array());
   }
 }
 
