diff --git a/modules/search.module b/modules/search.module
index 59972ef0b5399137e5faa91068fa41670cf41b15..97897c0cae4771e6650d8d01e22973b57bb3455e 100644
--- a/modules/search.module
+++ b/modules/search.module
@@ -137,8 +137,8 @@ function search_block($op = 'list', $delta = 0) {
     $blocks[0]['info'] = t('Search form');
     return $blocks;
   }
-  else if ($op == 'view' && user_access('search content') && arg(0) != 'search') {
-    $block['content'] = search_form('', '', null, '');
+  else if ($op == 'view' && user_access('search content')) {
+    $block['content'] = search_box('search_block_form');
     $block['subject'] = t('Search');
     return $block;
   }
@@ -1023,8 +1023,44 @@ function search_form_submit($form_id, $form_values) {
   return 'search/'. $type .'/'. $keys;
 }
 
-function search_box_submit($form_id, $form_values) {
-  return 'search/node/'. trim($form_values['keys']);
+/**
+ * Output a search form for the search block and the theme's search box.
+ */
+function search_box($form_id = 'search_theme_form') {
+  // Use search_keys instead of keys to avoid ID conflicts with the search block.
+  $form[$form_id .'_keys'] = array(
+    '#type' => 'textfield',
+    '#size' => 15,
+    '#default_value' => '',
+    '#attributes' => array('title' => t('Enter the terms you wish to search for.')),
+  );
+  if ($form_id == 'search_theme_form') {
+    $form['#theme']['theme_search_theme_form'] = array();
+  }
+  $form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
+
+  return drupal_get_form($form_id, $form, 'search_box_form');
+}
+
+/**
+ * Process a block search form submission.
+ */
+function search_box_form_submit($form_id, $form_values) {
+  return 'search/node/'. trim($form_values[$form_id .'_keys']);
+}
+
+/**
+ * Theme the theme search form.
+ */
+function theme_search_theme_form($form) {
+  return '<div id="search" class="container-inline">'. form_render($form) .'</div>';
+}
+
+/**
+ * Theme the block search form.
+ */
+function theme_search_block_form($form) {
+  return '<div class="container-inline">'. form_render($form) .'</div>';
 }
 
 /**
diff --git a/modules/search/search.module b/modules/search/search.module
index 59972ef0b5399137e5faa91068fa41670cf41b15..97897c0cae4771e6650d8d01e22973b57bb3455e 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -137,8 +137,8 @@ function search_block($op = 'list', $delta = 0) {
     $blocks[0]['info'] = t('Search form');
     return $blocks;
   }
-  else if ($op == 'view' && user_access('search content') && arg(0) != 'search') {
-    $block['content'] = search_form('', '', null, '');
+  else if ($op == 'view' && user_access('search content')) {
+    $block['content'] = search_box('search_block_form');
     $block['subject'] = t('Search');
     return $block;
   }
@@ -1023,8 +1023,44 @@ function search_form_submit($form_id, $form_values) {
   return 'search/'. $type .'/'. $keys;
 }
 
-function search_box_submit($form_id, $form_values) {
-  return 'search/node/'. trim($form_values['keys']);
+/**
+ * Output a search form for the search block and the theme's search box.
+ */
+function search_box($form_id = 'search_theme_form') {
+  // Use search_keys instead of keys to avoid ID conflicts with the search block.
+  $form[$form_id .'_keys'] = array(
+    '#type' => 'textfield',
+    '#size' => 15,
+    '#default_value' => '',
+    '#attributes' => array('title' => t('Enter the terms you wish to search for.')),
+  );
+  if ($form_id == 'search_theme_form') {
+    $form['#theme']['theme_search_theme_form'] = array();
+  }
+  $form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
+
+  return drupal_get_form($form_id, $form, 'search_box_form');
+}
+
+/**
+ * Process a block search form submission.
+ */
+function search_box_form_submit($form_id, $form_values) {
+  return 'search/node/'. trim($form_values[$form_id .'_keys']);
+}
+
+/**
+ * Theme the theme search form.
+ */
+function theme_search_theme_form($form) {
+  return '<div id="search" class="container-inline">'. form_render($form) .'</div>';
+}
+
+/**
+ * Theme the block search form.
+ */
+function theme_search_block_form($form) {
+  return '<div class="container-inline">'. form_render($form) .'</div>';
 }
 
 /**
diff --git a/modules/system.module b/modules/system.module
index ae7d2580d0504867f889d3cd8a3dd3a043e8b26c..54182afaa3e08e22fe2683899b361790b2b835a5 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -1210,25 +1210,6 @@ function system_theme_settings($key = '') {
 
 }
 
-/**
- * Output a search form.
- */
-function search_box($path = NULL) {
-  $form['keys'] = array('#type' => 'textfield', '#size'=> 15, '#default_value' => '', '#attributes' => array('alt' => t('Enter the terms you wish to search for.')));
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
-  return drupal_get_form('search_box', $form);
-}
-
-/**
- * Theme a search form.
- */
-function theme_search_box($form) {
-  $output = '<div id="search" class="container-inline">';
-  $output .= form_render($form);
-  $output .= '</div>';
-  return $output;
-}
-
 /**
  * Output a confirmation form
  *
diff --git a/modules/system/system.module b/modules/system/system.module
index ae7d2580d0504867f889d3cd8a3dd3a043e8b26c..54182afaa3e08e22fe2683899b361790b2b835a5 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -1210,25 +1210,6 @@ function system_theme_settings($key = '') {
 
 }
 
-/**
- * Output a search form.
- */
-function search_box($path = NULL) {
-  $form['keys'] = array('#type' => 'textfield', '#size'=> 15, '#default_value' => '', '#attributes' => array('alt' => t('Enter the terms you wish to search for.')));
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
-  return drupal_get_form('search_box', $form);
-}
-
-/**
- * Theme a search form.
- */
-function theme_search_box($form) {
-  $output = '<div id="search" class="container-inline">';
-  $output .= form_render($form);
-  $output .= '</div>';
-  return $output;
-}
-
 /**
  * Output a confirmation form
  *