--- elf.module.old	2008-01-27 03:13:40.000000000 +0100
+++ elf.module	2008-01-27 12:01:01.000000000 +0100
@@ -37,6 +37,13 @@
     '#description' => t('When enabled, this will include a CSS file on each page that adds an !icon next to each external and mailto link with the class "external-link" or "mailto-link".', array('!icon' => theme_image(drupal_get_path('module', 'elf') .'/elf.png'))),
   );
 
+  $form['elf_newwindow'] = array(
+    '#type' => 'checkbox',
+    '#default_value' => variable_get('elf_newwindow', FALSE),
+    '#title' => t('Open external links in a new window.'),
+    '#description' => t('When enabled, this will open external links in a new browser window.'),
+  );
+
   return system_settings_form($form);
 }
 
@@ -78,6 +85,10 @@
       // append external class if this <a> already has a class
       $link = preg_replace('!class="([^"]+)"!', 'class="${1} external-link"', $match[0]);
     }
+
+    if (variable_get('elf_newwindow', FALSE)) {
+      $link = substr($link, 0, -1) . ' target="_blank">';
+    }
   }
   // mailto link
   else if (strpos($match[1], 'mailto:') == 0) {
