Index: extlink.module
===================================================================
--- extlink.module
+++ extlink.module
@@ -19,13 +19,22 @@
  */
 function extlink_init() {
   $path = drupal_get_path('module', 'extlink');
-  drupal_add_js($path .'/extlink.js');
+  drupal_add_js($path .'/extlink.js');   
+  
+  $div_inc = variable_get('extlink_div_include', '') ? split("\n", variable_get('extlink_div_include', '')) : array();   
+  foreach($div_inc as $div) {
+    $div = trim($div);
+    if ($div) $divs[] = $div;
+  }
+  if (!$divs) $divs = array("div");  // passing "div" ensures we still loop through JS if no divs specified   
+  
   drupal_add_js(array('extlink' => array(
     'extTarget'     => variable_get('extlink_target', 0),
     'extClass'      => variable_get('extlink_class', 'ext'),
     'extSubdomains' => variable_get('extlink_subdomains', 1),
     'extExclude'    => variable_get('extlink_exclude', ''),
-    'extInclude'    => variable_get('extlink_include', ''),
+    'extInclude'    => variable_get('extlink_include', ''),   
+    'extDivInclude' => $divs,
     'extAlert'      => variable_get('extlink_alert', 0),
     'extAlertText'  => variable_get('extlink_alert_text', 'This link will take you to an external web site. We are not responsible for their content.'),
     'mailtoClass'   => variable_get('extlink_mailto_class', 'mailto'))), 'setting'
@@ -96,7 +105,12 @@
     '<em>?</em> ' . t('The previous character or set is optional.'),
     '<em>\d</em> ' . t('Matches any digit (0-9).'),
     '<em>[a-z]</em> ' . t('Brackets may be used to match a custom set of characters. This matches any alphabetic letter.'),
-  );
+  );       
+  
+  $examples = array(
+    t('#block-block-8'),
+    t('.view-display-id-block_1'),
+   );
 
   $form['patterns'] = array(
     '#tree' => FALSE,
@@ -128,6 +142,25 @@
     '#default_value' => variable_get('extlink_include', ''),
     '#description' => t('Enter a regular expression for internal links that you wish to be considered external.'),
   );
+  
+  $form['divs'] = array(
+    '#tree' => FALSE,
+    '#type' => 'fieldset',
+    '#title' => t('Div matching'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#description' => t('Apply Ext Links ONLY to links which fall into a DIV matching either an ID or CLASS.'),
+  );         
+  
+  $form['divs']['extlink_div_include'] = array(
+    '#type' => 'textarea',
+    '#rows' => 5,
+    '#title' => t('Include classes or ids to match'),
+    '#maxlength' => NULL,
+    '#default_value' => variable_get('extlink_div_include', ''),
+    '#description' => t('Enter a list of DIV ids or classes which are the ONLY areas where Ext Links should be applied. Use a # to denote an ID or a period to denote a CLASS. Some examples include:') .
+      theme('item_list', $examples),
+  );
 
   return system_settings_form($form);
 }
Index: extlink.js
===================================================================
--- extlink.js
+++ extlink.js
@@ -39,17 +39,20 @@
   // In jQuery 1.1 and higher, we'd use a filter method here, but it is not
   // available in jQuery 1.0 (Drupal 5 default).
   var external_links = new Array();
-  var mailto_links = new Array();
-  $("a:not(." + Drupal.settings.extlink.extClass + ", ." + Drupal.settings.extlink.mailtoClass + ")", context).each(function(el) {
-    try {
-      var url = this.href.toLowerCase();
-      if (url.indexOf('http') == 0 && (!url.match(internal_link) || (extInclude && url.match(extInclude))) && !(extExclude && url.match(extExclude))) {
-        external_links.push(this);
+  var mailto_links = new Array();     
+  // if we specified specific divs let's use those; otherwise we use "div" and look everywhere
+  $.each(Drupal.settings.extlink.extDivInclude, function() {      
+    $(this + " a:not(." + Drupal.settings.extlink.extClass + ", ." + Drupal.settings.extlink.mailtoClass + ")", context).each(function(el) {
+      try {
+        var url = this.href.toLowerCase();
+        if (url.indexOf('http') == 0 && (!url.match(internal_link) || (extInclude && url.match(extInclude))) && !(extExclude && url.match(extExclude))) {
+          external_links.push(this);
+        }
+        else if (url.indexOf('mailto:') == 0) {
+          mailto_links.push(this);
+        }
       }
-      else if (url.indexOf('mailto:') == 0) {
-        mailto_links.push(this);
-      }
-    }
+    
     // IE7 throws errors often when dealing with irregular links, such as:
     // <a href="node/10"></a> Empty tags.
     // <a href="http://user:pass@example.com">example</a> User:pass syntax.
@@ -57,6 +60,8 @@
       return false;
     }
   });
+  }
+  );
 
   if (Drupal.settings.extlink.extClass) {
     // Apply the "ext" class to all links not containing images.