### Eclipse Workspace Patch 1.0
#P adsense
Index: adsense.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/adsense.module,v
retrieving revision 1.50.2.24
diff -u -r1.50.2.24 adsense.module
--- adsense.module	28 Jan 2008 06:06:50 -0000	1.50.2.24
+++ adsense.module	3 Feb 2008 09:25:40 -0000
@@ -86,12 +86,25 @@
 define('ADSENSE_SEARCH_COLOR_URL',            'adsense_search_color_url');
 define('ADSENSE_SEARCH_COLOR_VISITED_URL',    'adsense_search_color_visited_url');
 define('ADSENSE_SEARCH_COLOR_LIGHT_URL',      'adsense_search_color_light_url');
+define('ADSENSE_SEARCH_COLOR_BOX_BACKGROUND', 'adsense_search_color_box_background');
+define('ADSENSE_SEARCH_COLOR_BOX_TEXT',       'adsense_search_color_box_text');
+define('ADSENSE_SEARCH_COLOR_WHITE',          'white');
+define('ADSENSE_SEARCH_COLOR_BLACK',          '#000000');
+define('ADSENSE_SEARCH_COLOR_GRAY',           '#cccccc');
 define('ADSENSE_SEARCH_DOMAIN',               'adsense_search_domain');
 define('ADSENSE_SEARCH_LANGUAGE',             'adsense_search_language');
+define('ADSENSE_SEARCH_ENCODING',             'adsense_search_encoding');
 define('ADSENSE_SEARCH_COUNTRY',              'adsense_search_country');
 define('ADSENSE_SEARCH_TEXTBOX_LENGTH',       'adsense_search_textbox_length');
+define('ADSENSE_SEARCH_LOGO',                 'adsense_search_logo');
+define('ADSENSE_SEARCH_LOGO_GOOGLE',          'adsense_search_logo_google');
+define('ADSENSE_SEARCH_LOGO_ABOVE_TEXTBOX',   'adsense_search_logo_above_textbox');
+define('ADSENSE_SEARCH_LOGO_ON_BUTTON',       'adsense_search_logo_on_button');
+define('ADSENSE_SEARCH_BUTTON',               'adsense_search_button');
 define('ADSENSE_SEARCH_FRAME_WIDTH',          'adsense_search_frame_width');
 define('ADSENSE_SEARCH_BOX',                  'Search Box');
+define('ADSENSE_SEARCH_PATH',                 'adsense/search');
+define('ADSENSE_SITE_SEARCH',                 '<!-- SiteSearch Google -->');
 
 function adsense_get_ad_code($format) {
   $all_ads = adsense_ad_formats();
@@ -162,7 +175,7 @@
       );
    }
    $items[] = array(
-       'path'     => 'adsense/search',
+       'path'     => ADSENSE_SEARCH_PATH,
        'callback' => 'adsense_search',
        'access'   => user_access('access adsense search result page'),
        'type'     => MENU_CALLBACK,
@@ -503,16 +516,91 @@
     '#title' => t('AdSense Search')
   );
 
+  $form['search']['box'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => true,
+    '#collapsed' => true,
+    '#title' => t('Search Box Options')
+  );
+
   global $base_url;
-  $form['search'][ADSENSE_SEARCH_DOMAIN] = array(
+  $form['search']['box'][ADSENSE_SEARCH_DOMAIN . '_0'] = array(
     '#type' => 'textfield',
-    '#title' => t('URL for SiteSearch'),
-    '#default_value' => variable_get(ADSENSE_SEARCH_DOMAIN, $base_url),
-    '#size' => 255,
+    '#title' => t('Google WebSearch + SiteSearch (withouth the last \'/\'); Allows users to search the web or the specific site(s) of your choice'),
+    '#field_prefix' => 'http://',
+    '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN . '_0'), str_replace('http://', '', $base_url)),
+    '#size' => 32,
     '#maxlength' => 255
   );
 
-  $form['search'][ADSENSE_SEARCH_COUNTRY] = array(
+  $form['search']['box'][ADSENSE_SEARCH_DOMAIN . '_1'] = array(
+    '#type' => 'textfield',
+    '#field_prefix' => 'http://',
+    '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN . '_1'), ''),
+    '#size' => 32,
+    '#maxlength' => 255
+  );
+
+  $form['search']['box'][ADSENSE_SEARCH_DOMAIN . '_2'] = array(
+    '#type' => 'textfield',
+    '#field_prefix' => 'http://',
+    '#default_value' => variable_get(str_replace('http://', '', ADSENSE_SEARCH_DOMAIN . '_2'), ''),
+    '#size' => 32,
+    '#maxlength' => 255
+  );
+
+  $form['search']['box'][ADSENSE_SEARCH_LOGO] = array(
+    '#type' => 'radios',
+    '#title' => t('Logo Type'),
+    '#default_value' => variable_get(ADSENSE_SEARCH_LOGO, ADSENSE_SEARCH_LOGO_GOOGLE),
+    '#options' => array(ADSENSE_SEARCH_LOGO_GOOGLE        => t('Google Logo'),
+                        ADSENSE_SEARCH_LOGO_ABOVE_TEXTBOX => t('Logo above text box'),
+                        ADSENSE_SEARCH_LOGO_ON_BUTTON     => t('"Google Search" on button'),
+                       )
+  );
+
+  $form['search']['box'][ADSENSE_SEARCH_BUTTON] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Search button below text box'),
+    '#return_value' => 1,
+    '#default_value' => variable_get(ADSENSE_SEARCH_BUTTON, 0)
+  );
+
+  $box_background_color = variable_get(ADSENSE_SEARCH_COLOR_BOX_BACKGROUND, ADSENSE_SEARCH_COLOR_WHITE);
+  $form['search']['box'][ADSENSE_SEARCH_COLOR_BOX_BACKGROUND] = array(
+    '#type' => 'select',
+    '#title' => t('Background Color'),
+    '#default_value' => $box_background_color,
+    '#options' => array(ADSENSE_SEARCH_COLOR_WHITE => t('White'),
+                        ADSENSE_SEARCH_COLOR_BLACK => t('Black'),
+                        ADSENSE_SEARCH_COLOR_GRAY  => t('Gray'),
+                       )
+  );
+
+  $box_text_color = variable_get(ADSENSE_SEARCH_COLOR_BOX_TEXT, ADSENSE_SEARCH_COLOR_BLACK);
+  if($box_background_color == ADSENSE_SEARCH_COLOR_BLACK) {
+    $box_text_color = ADSENSE_SEARCH_COLOR_WHITE;
+  } elseif($box_background_color == ADSENSE_SEARCH_COLOR_WHITE) {
+    $box_text_color = ADSENSE_SEARCH_COLOR_BLACK;
+  }
+
+  $form['search']['box'][ADSENSE_SEARCH_COLOR_BOX_TEXT] = array(
+    '#type' => 'select',
+    '#title' => t('Text Color'),
+    '#default_value' => $box_text_color,
+    '#options' => array(ADSENSE_SEARCH_COLOR_BLACK => t('Black'),
+                        ADSENSE_SEARCH_COLOR_WHITE => t('White')
+                       )
+  );
+
+  $form['search']['result'] = array(
+    '#type' => 'fieldset',
+    '#collapsible' => true,
+    '#collapsed' => true,
+    '#title' => t('Search Results Style')
+  );
+
+  $form['search']['result'][ADSENSE_SEARCH_COUNTRY] = array(
     '#type' => 'select',
     '#title' => t('Country or territory for Google domain'),
     '#default_value' => variable_get(ADSENSE_SEARCH_COUNTRY, 'www.google.com'),
@@ -758,7 +846,7 @@
                        )
   );
 
-  $form['search'][ADSENSE_SEARCH_LANGUAGE] = array(
+  $form['search']['box'][ADSENSE_SEARCH_LANGUAGE] = array(
     '#type' => 'select',
     '#title' => t('Site Language'),
     '#default_value' => variable_get(ADSENSE_SEARCH_LANGUAGE, 'en'),
@@ -793,15 +881,51 @@
                        )
   );
 
-  $form['search'][ADSENSE_SEARCH_TEXTBOX_LENGTH] = array(
+  $form['search']['box'][ADSENSE_SEARCH_ENCODING] = array(
+    '#type' => 'select',
+    '#title' => t('Site Encoding'),
+    '#default_value' => variable_get(ADSENSE_SEARCH_ENCODING, 'UTF-8'),
+    '#options' => array('ISO-8859-1'   =>  t('West European Latin-1 (ISO-8859-1)'),
+                        'ISO-8859-15'  =>  t('West European Latin-9 (ISO-8859-15)'),
+                        'windows-1252' =>  t('Western (Windows-1252)'),
+                        'ISO-8859-10'  =>  t('Nordic Latin-6 (ISO-8859-10)'),
+                        'ISO-8859-7'   =>  t('Greek (ISO-8859-7)'),
+                        'Shift_JIS'    =>  t('Japanese (Shift_JIS)'),
+                        'EUC-JP'       =>  t('Japanese (EUC-JP)'),
+                        'ISO-2022-JP'  =>  t('Japanese (ISO-2022-JP)'),
+                        'GB2312'       =>  t('Chinese Simplified (GB2312)'),
+                        'GB18030'      =>  t('Chinese Simplified (GB18030)'),
+                        'big5'         =>  t('Chinese Traditional (Big5)'),
+                        'EUC-KR'       =>  t('Korean (EUC-KR)'),
+                        'windows-874'  =>  t('Thai (Windows-874)'),
+                        'windows-1258' =>  t('Vietnamese (Windows-1258)'),
+                        'ISO-8859-2'   =>  t('Central European Latin-2 (ISO-8859-2)'),
+                        'windows-1250' =>  t('Central European (Windows-1250)'),
+                        'cp852'        =>  t('Central European (CP852)'),
+                        'ISO-8859-9'   =>  t('Turkish Latin-5 (ISO-8859-9)'),
+                        'windows-1254' =>  t('Turkish (Windows-1254)'),
+                        'ISO-8859-3'   =>  t('South European Latin-3 (ISO-8859-3)'),
+                        'ISO-8859-8-I' =>  t('Hebrew (ISO-8859-8-I)'),
+                        'windows-1255' =>  t('Hebrew (Windows-1255)'),
+                        'windows-1256' =>  t('Arabic (Windows-1256)'),
+                        'ISO-8859-5'   =>  t('Cyrillic (ISO-8859-5)'),
+                        'KOI8-R'       =>  t('Cyrillic (KOI8-R)'),
+                        'windows-1251' =>  t('Cyrillic (Windows-1251)'),
+                        'cp-866'       =>  t('Cyrillic/Russian (CP-866)'),
+                        'UTF-8'        =>  t('Unicode (UTF-8)')
+                       )
+  );
+
+  $textbox_length = $textbox_length > 64 ? 64 : variable_get(ADSENSE_SEARCH_TEXTBOX_LENGTH, 15);
+  $form['search']['box'][ADSENSE_SEARCH_TEXTBOX_LENGTH] = array(
     '#type' => 'textfield',
-    '#title' => t('Length of text box'),
-    '#default_value' => variable_get(ADSENSE_SEARCH_TEXTBOX_LENGTH, 15),
+    '#title' => t('Length of text box (Max 64): '),
+    '#default_value' => $textbox_length,
     '#size' => 2,
     '#maxlength' => 2
   );
 
-  $form['search'][ADSENSE_SEARCH_FRAME_WIDTH] = array(
+  $form['search']['result'][ADSENSE_SEARCH_FRAME_WIDTH] = array(
     '#type' => 'textfield',
     '#title' => t('Width of results area'),
     '#default_value' => variable_get(ADSENSE_SEARCH_FRAME_WIDTH, 500),
@@ -1111,13 +1235,15 @@
     ADSENSE_TYPE_SEARCH => 0,
     );
 
+  $max_ads = array(
+    ADSENSE_TYPE_AD     => 3,
+    ADSENSE_TYPE_LINK   => 3,
+    ADSENSE_TYPE_SEARCH => 2,
+    );
+
   $ad_list = adsense_ad_formats();
   $type = $ad_list[$format]['type'];
-  if ($num_ads[ADSENSE_TYPE_SEARCH] < 1) {
-    $num_ads[$type]++;
-    $ret = TRUE;
-  }
-  elseif ($num_ads[$type] < 3) {
+  if ($num_ads[$type] < $max_ads[$type]) {
     $num_ads[$type]++;
     $ret = TRUE;
   }
@@ -1628,60 +1754,162 @@
   $visited  = variable_get(ADSENSE_SEARCH_COLOR_VISITED_URL, '663399');
   $light    = variable_get(ADSENSE_SEARCH_COLOR_LIGHT_URL,   '0000FF');
 
+  $logo           = variable_get(ADSENSE_SEARCH_LOGO, ADSENSE_SEARCH_LOGO_GOOGLE);
+  $search_button  = variable_get(ADSENSE_SEARCH_BUTTON, 0);
+
+  $box_text_color       = variable_get(ADSENSE_SEARCH_COLOR_BOX_TEXT      , ADSENSE_SEARCH_COLOR_BLACK);
+  $box_background_color = variable_get(ADSENSE_SEARCH_COLOR_BOX_BACKGROUND, ADSENSE_SEARCH_COLOR_WHITE);
+  $encoding = variable_get(ADSENSE_SEARCH_ENCODING, 'UTF-8');
+
   $channel  = variable_get(ADSENSE_AD_CHANNEL . _adsense_validate_channel($channel), '');
 
   global $base_url;
-  $domain         = variable_get(ADSENSE_SEARCH_DOMAIN,         $base_url);
+  $domain_0 = variable_get(ADSENSE_SEARCH_DOMAIN . '_0', $base_url);
+  $domain_1 = variable_get(ADSENSE_SEARCH_DOMAIN . '_1', '');
+  $domain_2 = variable_get(ADSENSE_SEARCH_DOMAIN . '_2', '');
+  $domain   = $domain_1 ? "$domain_0;$domain_1" : $domain_0;
+  $domain   = $domain_2 ? "$domain_0;$domain_2" : $domain_0;
+
   $language       = variable_get(ADSENSE_SEARCH_LANGUAGE,       'en');
   $textbox_length = variable_get(ADSENSE_SEARCH_TEXTBOX_LENGTH, 15);
 
-  $output .= _adsense_add_nl('<form method="get" action="/adsense/search" target="_top" style="text-align:left;">');
-  $output .= _adsense_add_nl('<input type="hidden" name="domains" value="'    . $domain  . '"></input>');
-  $output .= _adsense_add_nl('<input type="text" name="as_q" size="'          . $textbox_length . '" maxlength="255" value="' . $_GET['as_q'] . '" class="form-text"></input>');
-  $output .= _adsense_add_nl('<input type="hidden" name="sitesearch" value="' . $domain  . '"></input>');
-  $output .= _adsense_add_nl('<input type="hidden" name="client" value="'     . $client  . '"></input>');
-  $output .= _adsense_add_nl('<input type="hidden" name="channel" value="'    . $channel . '"></input>');
-  $output .= _adsense_add_nl('<input type="hidden" name="forid" value="1"></input>' );
-  $output .= _adsense_add_nl('<input type="hidden" name="ie" value="UTF-8"></input>');
-  $output .= _adsense_add_nl('<input type="hidden" name="oe" value="UTF-8"></input>');
-  $output .= _adsense_add_nl('<input type="hidden" name="cof" value="GALT:'          . $url
-                                                                 . ';GL:1;DIV:'      . $border
-                                                                 . ';VLC:'           . $visited
-                                                                 . ';AH:center;BGC:' . $bg
-                                                                 . ';ALC:'           . $title
-                                                                 . ';LC:'            . $title
-                                                                 . ';T:'             . $text
-                                                                 . ';GFNT:'          . $light
-                                                                 . ';GIMP:'          . $light
+
+  $output .= _adsense_add_nl('<div class="adsense adsense_search">');
+  $output .= _adsense_add_nl(ADSENSE_SITE_SEARCH);
+  $output .= _adsense_add_nl('<form method="get" action="' . "http://$domain/". ADSENSE_SEARCH_PATH . '" target="_top">');
+  $output .= _adsense_add_nl('<table border="0" bgcolor="'. $box_background_color . '">');
+  $output .= _adsense_add_nl('<tr><td nowrap="nowrap" valign="top" align="left" height="32">');
+  if($logo != ADSENSE_SEARCH_LOGO_ON_BUTTON) {
+    $output .= _adsense_add_nl('<a href="http://www.google.com/">');
+    if($box_background_color == ADSENSE_SEARCH_COLOR_WHITE) {
+      $logo_color = 'wht';
+    } elseif($box_background_color == ADSENSE_SEARCH_COLOR_BLACK) {
+      $logo_color = 'blk';
+    } elseif($box_background_color == ADSENSE_SEARCH_COLOR_GRAY) {
+      $logo_color = 'gry';
+    }
+    $output .= _adsense_add_nl('<img src="http://www.google.com/logos/Logo_25' . $logo_color . '.gif" border="0" alt="Google" align="middle"></img></a>');
+  }
+
+  if($logo == ADSENSE_SEARCH_LOGO_GOOGLE) {
+    $output .= _adsense_add_nl('</td>');
+    $output .= _adsense_add_nl('<td nowrap="nowrap">');
+  } elseif($logo == ADSENSE_SEARCH_LOGO_ABOVE_TEXTBOX) {
+    $output .= _adsense_add_nl('<br/>');
+  }
+
+  $output .= _adsense_add_nl('<input type="hidden" name="domains" value="' . $domain . '"></input>');
+  $output .= _adsense_add_nl('<label for="sbi" style="display: none">' . t('Enter your search terms') . '</label>');
+  $output .= _adsense_add_nl('<input type="text" name="as_q" size="' . $textbox_length . '" maxlength="255" value="" id="sbi"></input>');
+
+  if(!$search_button) {
+    $output .= _adsense_add_nl('<label for="sbb" style="display: none">' . t('Submit search form') . '</label>');
+    if($logo != ADSENSE_SEARCH_LOGO_ON_BUTTON) {
+      $output .= _adsense_add_nl('<input type="submit" name="sa" value="' . t('Search')        . '" id="sbb"></input>');
+    } else {
+      $output .= _adsense_add_nl('<input type="submit" name="sa" value="' . t('Google Search') . '" id="sbb"></input>');
+    }
+  }
+
+  $output .= _adsense_add_nl('</td></tr>');
+  $output .= _adsense_add_nl('<tr>');
+
+  if($logo == ADSENSE_SEARCH_LOGO_GOOGLE) {
+    $output .= _adsense_add_nl('<td>&nbsp;</td>');
+  }
+
+  $output .= _adsense_add_nl('<td nowrap="nowrap">');
+  $output .= _adsense_add_nl('<table>');
+  $output .= _adsense_add_nl('<tr>');
+  $output .= _adsense_add_nl('<td>');
+  $output .= _adsense_add_nl('<input type="radio" name="sitesearch" value="" id="ss0"></input>');
+  $output .= _adsense_add_nl('<label for="ss0" title="' . t('Search the Web') . '"><font size="-1" color="'. $box_text_color . '">Web</font></label></td>');
+  $output .= _adsense_add_nl('<td>');
+  $output .= _adsense_add_nl('<input type="radio" name="sitesearch" value="' . $domain_0 . '" checked id="ss1"></input>');
+  $output .= _adsense_add_nl('<label for="ss1" title="' . t('Search') . ' ' . $domain_0 . '"><font size="-1" color="' . $box_text_color .  '">' . $domain_0 . '</font></label></td>');
+  $output .= _adsense_add_nl('</tr>');
+  if($domain_1) {
+    $output .= _adsense_add_nl('<tr>');
+    $output .= _adsense_add_nl('<td>');
+    $output .= _adsense_add_nl('<input type="radio" name="sitesearch" value="' . $domain_1 . '" id="ss2"></input>');
+    $output .= _adsense_add_nl('<label for="ss2" title="Search ' . $domain_1 . '"><font size="-1" color="' . $box_text_color . '">' . $domain_1 . '</font></label></td>');
+    if($domain_2) {
+      $output .= _adsense_add_nl('<td>');
+      $output .= _adsense_add_nl('<input type="radio" name="sitesearch" value="' . $domain_2 .'" id="ss3"></input>');
+      $output .= _adsense_add_nl('<label for="ss3" title="Search ' . $domain_2 . '"><font size="-1" color="' . $box_text_color . '">' . $domain_2 . '</font></label></td>');
+    } else {
+      $output .= _adsense_add_nl('<td></td>');
+    }
+    $output .= _adsense_add_nl('</tr>');
+  }
+  $output .= _adsense_add_nl('</table>');
+
+  if($search_button) {
+    $output .= _adsense_add_nl('<label for="sbb" style="display: none">' . t('Submit search form') . '</label>');
+    if($logo != ADSENSE_SEARCH_LOGO_ON_BUTTON) {
+      $output .= _adsense_add_nl('<input type="submit" name="sa" value="' . t('Search')        . '" id="sbb"></input>');
+    } else {
+      $output .= _adsense_add_nl('<input type="submit" name="sa" value="' . t('Google Search') . '" id="sbb"></input>');
+    }
+  }
+
+  $output .= _adsense_add_nl('<input type="hidden" name="client" value="' . $client . '"></input>');
+  $output .= _adsense_add_nl('<input type="hidden" name="forid" value="1"></input>');
+  $output .= _adsense_add_nl('<input type="hidden" name="channel" value="' . $channel . '"></input>');
+  $output .= _adsense_add_nl('<input type="hidden" name="ie" value="' . $encoding . '"></input>');
+  $output .= _adsense_add_nl('<input type="hidden" name="oe" value="' . $encoding . '"></input>');
+  $output .= _adsense_add_nl('<input type="hidden" name="cof" value="GALT:#'          . $url
+                                                                 . ';GL:1;DIV:#'      . $border
+                                                                 . ';VLC:#'           . $visited
+                                                                 . ';AH:center;BGC:#' . $bg
+                                                                 . ';LBGC:#'          . $bg
+                                                                 . ';ALC:#'           . $title
+                                                                 . ';LC:#'            . $title
+                                                                 . ';T:#'             . $text
+                                                                 . ';GFNT:#'          . $light
+                                                                 . ';GIMP:#'          . $light
                                                                  . ';FORID:11"></input>');
-  $output .= _adsense_add_nl('<input type="hidden" name="hl" value="' . $language   . '"></input>');
-  $output .= _adsense_add_nl('<input type="submit" name="sa" value="' . t('Search') . '" class="form-submit"></input>');
+  $output .= _adsense_add_nl('<input type="hidden" name="hl" value="' . $language . '"></input>');
+  $output .= _adsense_add_nl('</td></tr></table>');
   $output .= _adsense_add_nl('</form>');
+  $output .= _adsense_add_nl(ADSENSE_SITE_SEARCH);
+  $output .= _adsense_add_nl('</div>');
 
   return $output;
 }
 
-function adsense_search() {
+function adsense_search($op = 'search', $keys = NULL) {
 
-  global $base_url;
-  $width   = variable_get(ADSENSE_SEARCH_FRAME_WIDTH, '500');
-  $domain  = variable_get(ADSENSE_SEARCH_DOMAIN     , $base_url);
-  $country = variable_get(ADSENSE_SEARCH_COUNTRY    , 'www.google.com');
+  if(!user_access('access adsense search result page')) return;
 
+  switch ($op) {
+    case 'name':
+      return t('Google AdSense for Search');
 
-  $output .= _adsense_add_nl(ADSENSE_SEARCH_RESULT_START);
-  $output .= _adsense_add_nl('<div id="googleSearchUnitIframe"></div>');
-
-  $output .= _adsense_add_nl('<script type="text/javascript">');
-  $output .= _adsense_add_nl('   var googleSearchIframeName = \'googleSearchUnitIframe\';');
-  $output .= _adsense_add_nl('   var googleSearchFrameWidth = ' . $width   . ';');
-  $output .= _adsense_add_nl('   var googleSearchFrameborder = 0 ;');
-  $output .= _adsense_add_nl('   var googleSearchDomain = \''   . $country . '\';');
-  $output .= _adsense_add_nl('</script>');
-  $output .= _adsense_add_nl('<script type="text/javascript"');
-  $output .= _adsense_add_nl('         src="http://www.google.com/afsonline/show_afs_search.js">');
-  $output .= _adsense_add_nl('</script>');
-  $output .= _adsense_add_nl(ADSENSE_SEARCH_RESULT_END);
+    case 'search':
 
-  return $output;
-}
+      // Log the search keys:
+      watchdog('AdSense', t('Keyword') . ': <em>' . urldecode($_GET['as_q']) . '</em>', WATCHDOG_NOTICE, 'AdSense for Search');
+
+      // Output search results
+      global $base_url;
+      $width   = variable_get(ADSENSE_SEARCH_FRAME_WIDTH, '500');
+      $domain  = variable_get(ADSENSE_SEARCH_DOMAIN . '_0'     , $base_url);
+      $country = variable_get(ADSENSE_SEARCH_COUNTRY    , 'www.google.com');
+    
+      $output .= _adsense_add_nl(ADSENSE_SEARCH_RESULT_START);
+      $output .= _adsense_add_nl('<div id="googleSearchUnitIframe"></div>');
+    
+      $output .= _adsense_add_nl('<script type="text/javascript">');
+      $output .= _adsense_add_nl('   var googleSearchIframeName = \'googleSearchUnitIframe\';');
+      $output .= _adsense_add_nl('   var googleSearchFrameWidth = ' . $width   . ';');
+      $output .= _adsense_add_nl('   var googleSearchFrameborder = 0 ;');
+      $output .= _adsense_add_nl('   var googleSearchDomain = \''   . $country . '\';');
+      $output .= _adsense_add_nl('</script>');
+      $output .= _adsense_add_nl('<script type="text/javascript"');
+      $output .= _adsense_add_nl('         src="http://www.google.com/afsonline/show_afs_search.js">');
+      $output .= _adsense_add_nl('</script>');
+      $output .= _adsense_add_nl(ADSENSE_SEARCH_RESULT_END);
+      return $output;
+  }
+}
\ No newline at end of file
