diff --git automodal.js automodal.js
index 8c05a2d..580cfbb 100644
--- automodal.js
+++ automodal.js
@@ -1,18 +1,13 @@
+// $Id$
+
 (function ($) {
-  Drupal.behaviors.automodal = function () {
-    var selector = Drupal.settings.automodal.selector || '.automodal';
-    
-    var settings = {
-      autoResize: true,
-      autoFit: true,
-      width: 600,
-      height: 400,
-      //onSubmit: function (a, b) {} 
-    }
-    
-    $(selector).click(function () {
+
+Drupal.behaviors.automodal = function (context) {
+
+  $.each(Drupal.settings.automodal, function(selector, settings) {
+    $(selector +':not(.automodal-processed)', context).addClass('automodal-processed').each(function () {
       settings.url = $(this).attr('href') || '#';
-      
+
       if (settings.url.indexOf('?') >= 0) {
         settings.url += '&'
       }
@@ -20,11 +15,13 @@
         settings.url += '?'
       }
       settings.url += 'automodal=true';
-      
-      Drupal.modalFrame.open(settings);
-      
-      return false;
+
+      $(this).bind('click', function() {
+        Drupal.modalFrame.open(settings);
+        return false;
+      });
     });
-  }
-  
+  });
+}
+
 })(jQuery);
\ No newline at end of file
diff --git automodal.module automodal.module
index 172ea45..b92c74d 100644
--- automodal.module
+++ automodal.module
@@ -57,20 +57,11 @@ function automodal_request_is_child() {
  * Implements hook_init();
  */
 function automodal_init() {
-  
-  $is_client = automodal_request_is_child();
-  
-  if ($is_client) {
+  if (automodal_request_is_child()) {
     modalframe_child_js();
   }
-  else {
-    $settings = array('automodal'=>array(
-      'selector' => variable_get('automodal_default_selector', '.automodal'),
-    ));
-    $base = drupal_get_path('module', 'automodal');
-    modalframe_parent_js();
-    drupal_add_js($settings, 'setting');
-    drupal_add_js($base . '/automodal.js');
+  elseif (variable_get('automodal_autoscan', 0)) {
+    automodal_add_automodal();
   }
 }
 
@@ -78,6 +69,9 @@ function automodal_init() {
  * Settings for automodal.
  */
 function automodal_settings_form($form, $form_state = NULL) {
+  drupal_set_title('Automodal Settings');
+  $form = array();
+
   $form['automodal_default_selector'] = array(
     '#type' => 'textfield',
     '#title' => t('CSS 3 Selector'),
@@ -87,6 +81,11 @@ function automodal_settings_form($form, $form_state = NULL) {
     '#maxlength' => 256,
     '#required' => FALSE,
   );
+  $form['automodal_autoscan'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Scan all pages adding automodal automatically'),
+    '#default_value' => variable_get('automodal_autoscan', 0),
+  );
   
   $opts = array(
     'attributes' => array('class' => 'automodal'),
@@ -95,10 +94,46 @@ function automodal_settings_form($form, $form_state = NULL) {
     '#type' => 'markup',
     '#value' => l('This anchor has the class "automodal".', 'admin/settings/automodal/test', $opts) . '<br/>',
   );
+  // for the automodal test
+  if (!variable_get('automodal_autoscan', 0)) automodal_add_automodal();
   
   return system_settings_form($form);
 }
 
 function automodal_test() {
   return t('It works!');
-}
\ No newline at end of file
+}
+
+function automodal_add_automodal($automodal_settings = array(), $automodal_selector = '') {
+  static $automodal_processed;
+  
+  // set default settings and default selector
+  $automodal_default_settings = array(
+    'autoFit' => true,
+    'draggable' => true,
+    'width' => 600,
+    'height' => 400,
+  );
+  $automodal_default_selector = variable_get('automodal_default_selector', '.automodal');
+
+  //select default if not set in arguments
+  $automodal_settings = empty($automodal_settings) ? $automodal_default_settings : $automodal_settings;
+  $automodal_selector = empty($automodal_selector) ? $automodal_default_selector : $automodal_selector;
+
+  // add js only once
+  if (!isset($automodal_processed)) {
+    $automodal_processed = array();  
+    $base = drupal_get_path('module', 'automodal');
+    modalframe_parent_js();
+    drupal_add_js($base . '/automodal.js');
+  }
+
+  // add only one settings for the same selector
+  if (!isset($automodal_processed[$automodal_selector])) {
+    $automodal_processed[$automodal_selector] = TRUE;
+    $js_settings = array(
+      $automodal_selector => $automodal_settings,
+    );
+    drupal_add_js(array('automodal' => $js_settings), 'setting');
+  }
+}
