diff -rupN captcha_old/captcha.admin.inc captcha/captcha.admin.inc
--- captcha_old/captcha.admin.inc	2009-02-03 06:44:08.000000000 +1100
+++ captcha.admin.inc	2009-03-25 14:20:40.000000000 +1100
@@ -30,7 +30,7 @@ function captcha_admin_settings() {
   $form['captcha_form_protection'] = array(
     '#type' => 'fieldset',
     '#title' => t('Form protection'),
-    '#description' => t('Select the challenge type you want for each of the listed forms (identified by their so called <em>form_id</em>\'s). You can easily add arbitrary forms with textfield at the bottom of the table or with the help of the \'%CAPTCHA_admin_links\' option below.',
+    '#description' => t('Select the challenge type you want for each of the listed forms (identified by their so called <em>form_id</em>\'s). Set <em>Weight</em> to Auto to automatically place the CAPTCHA form element just above the last submit button. You can easily add arbitrary forms with textfield at the bottom of the table or with the help of the \'%CAPTCHA_admin_links\' option below.',
       array('%CAPTCHA_admin_links' => t('Add CAPTCHA administration links to forms'))
       ),
   );
@@ -41,6 +41,7 @@ function captcha_admin_settings() {
   );
   $form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'] = array();
   $captcha_types = _captcha_available_challenge_types();
+  $weights = captcha_weight_options(50);
   $result = db_query("SELECT * FROM {captcha_points} ORDER BY form_id");
   while ($captcha_point = db_fetch_object($result)) {
     $form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id] = array();
@@ -53,6 +54,12 @@ function captcha_admin_settings() {
       '#default_value' => isset($captcha_point->module) ? "{$captcha_point->module}/{$captcha_point->type}": "none",
       '#options' => $captcha_types,
     );
+    // Weight select for captcha.
+    $form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id]['weight'] = array(
+      '#type' => 'select',
+      '#default_value' => $captcha_point->weight,
+      '#options' => $weights,
+    );
     // Additional operations.
     $form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id]['operations'] = array(
       '#value' => implode(", ", array(
@@ -74,6 +81,11 @@ function captcha_admin_settings() {
     '#default_value' => "{$captcha_point->module}/{$captcha_point->type}",
     '#options' => $captcha_types,
   );
+  // Weight select for captcha.
+  $form['captcha_form_protection']['captcha_form_id_overview']['captcha_new_captcha_point']['weight'] = array(
+    '#type' => 'weight',
+    '#options' => $weights,
+  );
 
   // Field for the CAPTCHA administration mode
   $form['captcha_form_protection']['captcha_administration_mode'] = array(
@@ -144,13 +156,14 @@ function captcha_admin_settings() {
  * Custom theme function for a table of (form_id -> CAPTCHA type) settings
  */
 function theme_captcha_admin_settings_captcha_points($form) {
-  $header = array('form_id', t('Challenge type (module)'), t('Operations'));
+  $header = array('form_id', t('Challenge type (module)'), t('Weight'), t('Operations'));
   $rows = array();
   // Existing CAPTCHA points.
   foreach (element_children($form['captcha_captcha_points']) as $key) {
     $row = array();
     $row[] = drupal_render($form['captcha_captcha_points'][$key]['form_id']);
     $row[] = drupal_render($form['captcha_captcha_points'][$key]['captcha_type']);
+    $row[] = drupal_render($form['captcha_captcha_points'][$key]['weight']);
     $row[] = drupal_render($form['captcha_captcha_points'][$key]['operations']);
     $rows[] = $row;
   }
@@ -158,6 +171,7 @@ function theme_captcha_admin_settings_ca
   $row = array();
   $row[] = drupal_render($form['captcha_new_captcha_point']['form_id']);
   $row[] = drupal_render($form['captcha_new_captcha_point']['captcha_type']);
+  $row[] = drupal_render($form['captcha_new_captcha_point']['weight']);
   $row[] = '';
   $rows[] = $row;
 
@@ -168,14 +182,14 @@ function theme_captcha_admin_settings_ca
 /**
  * Helper function for adding/updating a CAPTCHA point.
  */
-function _captcha_update_captcha_point($form_id, $captcha_type) {
+function _captcha_update_captcha_point($form_id, $captcha_type, $weight) {
   db_query("DELETE FROM {captcha_points} WHERE form_id = '%s'", $form_id);
   if ($captcha_type == 'none') {
-    db_query("INSERT INTO {captcha_points} (form_id, module, type) VALUES ('%s', NULL, NULL)", $form_id);
+    db_query("INSERT INTO {captcha_points} (form_id, module, type, weight) VALUES ('%s', NULL, NULL, '%s')", $form_id, $weight);
   }
   else {
     list($module, $type) = explode('/', $captcha_type);
-    db_query("INSERT INTO {captcha_points} (form_id, module, type) VALUES ('%s', '%s', '%s')", $form_id, $module, $type);
+    db_query("INSERT INTO {captcha_points} (form_id, module, type, weight) VALUES ('%s', '%s', '%s', '%s')", $form_id, $module, $type, $weight);
   }
 }
 
@@ -198,14 +212,15 @@ function captcha_admin_settings_submit($
 
   // Process CAPTCHA points
   foreach ($form_state['values']['captcha_form_id_overview']['captcha_captcha_points'] as $captcha_point_form_id => $data) {
-    _captcha_update_captcha_point($captcha_point_form_id, $data['captcha_type']);
+    _captcha_update_captcha_point($captcha_point_form_id, $data['captcha_type'], $data['weight']);
   }
 
   // Add new CAPTCHA point?
   $captcha_point_form_id = $form_state['values']['captcha_form_id_overview']['captcha_new_captcha_point']['form_id'];
   if (!empty($captcha_point_form_id)) {
     $captcha_type = $form_state['values']['captcha_form_id_overview']['captcha_new_captcha_point']['captcha_type'];
-    _captcha_update_captcha_point($captcha_point_form_id, $captcha_type);
+    $weight = $form_state['values']['captcha_form_id_overview']['captcha_new_captcha_point']['weight'];
+    _captcha_update_captcha_point($captcha_point_form_id, $captcha_type, $weight);
     drupal_set_message(t('Added CAPTCHA point.'), 'status');
   }
 
@@ -250,6 +265,8 @@ function captcha_point_admin($captcha_po
 function captcha_point_admin_form($form_state, $captcha_point_form_id=NULL) {
   $form = array();
   $default_captcha_type = 'none';
+  $default_weight = 'auto';
+  $weights = captcha_weight_options(50);
   if (isset($captcha_point_form_id)) {
     // use given CAPTCHA point form_id
     $form['captcha_point_form_id'] = array(
@@ -263,6 +280,7 @@ function captcha_point_admin_form($form_
     $captcha_point = db_fetch_object($result);
     if ($captcha_point) {
       $default_captcha_type = "{$captcha_point->module}/{$captcha_point->type}";
+      $default_weight = $captcha_point->weight;
     }
   }
   else {
@@ -281,6 +299,14 @@ function captcha_point_admin_form($form_
     '#default_value' => $default_captcha_type,
     '#options' => _captcha_available_challenge_types(),
   );
+  // Weight select for captcha.
+  $form['weight'] = array(
+    '#type' => 'select',
+    '#title' => t('Weight'),
+    '#description' => t('The weight of the CAPTCHA form element for this form. Leave set to Auto to automatically place it just above the last submit button.'),
+    '#default_value' => $default_weight,
+    '#options' => $weights,
+  );
   // redirect to general CAPTCHA settings page after submission
   $form['#redirect'] = 'admin/user/captcha';
   // submit button
@@ -308,7 +334,8 @@ function captcha_point_admin_form_valida
 function captcha_point_admin_form_submit($form, $form_state) {
   $captcha_point_form_id = $form_state['values']['captcha_point_form_id'];
   $captcha_type = $form_state['values']['captcha_type'];
-  _captcha_update_captcha_point($captcha_point_form_id, $captcha_type);
+  $weight = $form_state['values']['weight'];
+  _captcha_update_captcha_point($captcha_point_form_id, $captcha_type, $weight);
   drupal_set_message(t('Saved CAPTCHA point settings.'), 'status');
 }
 
@@ -347,7 +374,7 @@ function captcha_point_disable_confirm_s
     drupal_set_message(t('Deleted CAPTCHA for form %form_id.', array('%form_id' => $captcha_point_form_id)));
   }
   else {
-    db_query("UPDATE {captcha_points} SET module = NULL, type = NULL WHERE form_id = '%s'", $captcha_point_form_id);
+    db_query("UPDATE {captcha_points} SET module = NULL, type = NULL, weight = 'auto' WHERE form_id = '%s'", $captcha_point_form_id);
     drupal_set_message(t('Disabled CAPTCHA for form %form_id.', array('%form_id' => $captcha_point_form_id)));
   }
   $form_state['redirect'] = 'admin/user/captcha/captcha';
@@ -403,3 +430,21 @@ function captcha_examples($form_state, $
   }
   return $form;
 }
+
+/**
+ * Create weight options for captcha including the 'Auto' option
+ */
+function captcha_weight_options($delta = 10) {
+  if (!is_numeric($delta)) {
+    $delta = 10;
+  }
+
+  $weights = array();
+  $weights['auto'] = 'Auto';
+
+  for ($n = (-1 * $delta); $n <= $delta; $n++) {
+    $weights[$n] = $n;
+  }
+
+  return $weights;
+}
\ No newline at end of file
diff -rupN captcha_old/captcha.install captcha/captcha.install
--- captcha_old/captcha.install	2009-03-23 07:06:39.000000000 +1100
+++ captcha.install	2009-03-25 14:20:40.000000000 +1100
@@ -25,6 +25,13 @@ function captcha_schema() {
         'type' => 'varchar',
         'length' => 64,
       ),
+      'weight' => array(
+        'description' => t('The weight of the CAPTCHA form element.  Will be a number or \'auto\''),
+        'type' => 'varchar',
+        'length' => 4,
+        'not null' => TRUE,
+        'default' => 'auto',
+      ),
     ),
     'primary key' => array('form_id'),
   );
@@ -108,7 +115,7 @@ function captcha_install() {
   $form_ids = array('comment_form', 'contact_mail_user', 'contact_mail_page',
     'user_register', 'user_pass', 'user_login', 'user_login_block');
   foreach ($form_ids as $form_id) {
-    db_query("INSERT INTO {captcha_points} (form_id, module, type) VALUES ('%s', NULL, NULL)", $form_id);
+    db_query("INSERT INTO {captcha_points} (form_id, module, type, weight) VALUES ('%s', NULL, NULL, 'auto')", $form_id);
   }
 
   // what to do after install?
@@ -257,3 +264,13 @@ function captcha_update_6200() {
 
   return $items;
 }
+
+/**
+ * Implementation of hook_update_N()
+ */
+function captcha_update_6201() {
+  // Add support for captcha field weight
+  $ret = array();
+  db_add_field($ret, 'captcha_points', 'weight', array('type' => 'varchar', 'length' => 4, 'not null' => TRUE, 'default' => 'auto', 'description' => t('The weight of the CAPTCHA form element.  Will be a number or \'auto\'')));
+  return $ret;
+}
\ No newline at end of file
diff -rupN captcha_old/captcha.module captcha/captcha.module
--- captcha_old/captcha.module	2009-03-23 07:06:39.000000000 +1100
+++ captcha.module	2009-03-25 15:20:16.000000000 +1100
@@ -180,7 +180,7 @@ function captcha_form_alter(&$form, $for
   }
   elseif (user_access('administer CAPTCHA settings') && variable_get('captcha_administration_mode', FALSE) && arg(0) != 'admin') {
     // For administrators: show CAPTCHA info and offer link to configure it
-    $result = db_query("SELECT module, type FROM {captcha_points} WHERE form_id = '%s'", $form_id);
+    $result = db_query("SELECT module, type, weight FROM {captcha_points} WHERE form_id = '%s'", $form_id);
     if (!$result) {
       return;
     }
@@ -190,6 +190,7 @@ function captcha_form_alter(&$form, $for
       '#title' => t('CAPTCHA'),
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,
+      '#weight' => $captcha_point->weight,
     );
     if ($captcha_point && $captcha_point->type) {
       $form['captcha']['#title'] = t('CAPTCHA: "@type" enabled', array('@type' => $captcha_point->type));
@@ -326,13 +327,20 @@ function captcha_pre_render_untrusted_us
  * files).
  */
 function captcha_pre_render_place_captcha($form) {
+  if ($form['captcha']['captcha_info']['#value']['weight'] == 'auto' || $form['captcha']['#weight'] == 'auto') {
   // search the weights of the buttons in the form
   $button_weights = array();
   foreach (element_children($form) as $key) {
-    if ($key == 'buttons' || isset($form[$key]['#type']) && ($form[$key]['#type'] == 'submit' || $form[$key]['#type'] == 'button')) {
+    if (isset($form[$key]['#type']) && ($form[$key]['#type'] == 'submit' || $form[$key]['#type'] == 'button')) {
       $button_weights[] = $form[$key]['#weight'];
     }
+    else if ($key == 'buttons') {
+      foreach (element_children($form[$key]) as $button) {
+        $button_weights[] = $form[$key][$button]['#weight'];
+      }
+    }
   }
+
   if ($button_weights) {
     // set the weight of the CAPTCHA element a tiny bit smaller than the lightest button weight
     // (note that the default resolution of #weight values is 1/1000 (see drupal/includes/form.inc))
@@ -341,6 +349,8 @@ function captcha_pre_render_place_captch
     // make sure the form gets sorted before rendering
     unset($form['#sorted']);
   }
+ }
+
   return $form;
 }
 
diff -rupN captcha_old/captcha.pages.inc captcha/captcha.pages.inc
--- captcha_old/captcha.pages.inc	2009-02-07 04:45:20.000000000 +1100
+++ captcha.pages.inc	2009-03-25 15:15:32.000000000 +1100
@@ -7,7 +7,7 @@
 function _captcha_form_alter_untrusted_user(&$form, $form_state, $form_id) {
 
   // Get CAPTCHA type and module for given form_id. Return if no CAPTCHA was set.
-  $captcha_point = db_fetch_object(db_query("SELECT module, type FROM {captcha_points} WHERE form_id = '%s'", $form_id));
+  $captcha_point = db_fetch_object(db_query("SELECT module, type, weight FROM {captcha_points} WHERE form_id = '%s'", $form_id));
   if (!$captcha_point || !$captcha_point->type) {
     return;
   }
@@ -92,12 +92,16 @@ function _captcha_form_alter_untrusted_u
     '#value' => array(
       'module' => $captcha_point->module,
       'type' => $captcha_point->type,
+      'weight' => $captcha_point->weight,
       'captcha_sid' => $captcha_sid,
       'solution' => $captcha['solution'],
       'preprocess' => isset($captcha['preprocess'])? $captcha['preprocess'] : FALSE,
     ),
   );
 
-
+  // Add weight if not 'auto'
+  if ($captcha_point->weight != 'auto') {
+    $form['captcha']['#weight'] = $captcha_point->weight;
+  }
 }
 
