Index: mollom/mollom.module
===================================================================
--- mollom/mollom.module	(revision 35)
+++ mollom/mollom.module	(working copy)
@@ -605,6 +605,7 @@
     $element['session_id'] = array(
       '#type' => 'hidden',
       '#value' => time() .'-'. $mollom_state['#session_id'],
+      '#attributes' => array('class' => 'mollom-session-id'),
     );
     cache_set($mollom_state['#session_id'], $mollom_state, 'cache_mollom', time() + 60*30);
 
@@ -773,7 +774,7 @@
       '#type' => 'textfield',
       '#processed' => TRUE,
       '#title' => t('Word verification'),
-      '#field_prefix' => '<a href="http://mollom.com" id="mollom-captcha"><img src="'. url($response['url']) .'" alt="Mollom CAPTCHA" /></a> (<a href="#" id="mollom-audio-captcha">'. t('play audio CAPTCHA') .'</a>)',
+      '#field_prefix' => '<a href="http://mollom.com" class="mollom-captcha"><img src="'. url($response['url']) .'" alt="Mollom CAPTCHA" /></a> (<a href="#" class="mollom-audio-captcha">'. t('play audio CAPTCHA') .'</a>)',
       '#required' => TRUE,
       '#size' => 10,
       // The previously entered value is useless because the captcha is regenerated at each form rebuild.
Index: mollom/mollom.pages.inc
===================================================================
--- mollom/mollom.pages.inc	(revision 35)
+++ mollom/mollom.pages.inc	(working copy)
@@ -17,15 +17,15 @@
   if ($type == 'audio') {
     $response = mollom('mollom.getAudioCaptcha', array('author_ip' => ip_address(), 'session_id' => $session_id));
     if ($response) {
-      $output  = '<a href="http://mollom.com" id="mollom-captcha"><embed src="'. check_plain($response['url']) .'" autostart="true" width="120" height="30" /></a>';
-      $output .= ' (<a href="#" id="mollom-image-captcha">'. t('use image CAPTCHA') .'</a>)';
+      $output  = '<a href="http://mollom.com" class="mollom-captcha"><embed src="'. check_plain($response['url']) .'" autostart="true" width="120" height="30" /></a>';
+      $output .= ' (<a href="#" class="mollom-image-captcha">'. t('use image CAPTCHA') .'</a>)';
     }
   }
   elseif ($type == 'image') {
     $response = mollom('mollom.getImageCaptcha', array('author_ip' => ip_address(), 'session_id' => $session_id));
     if ($response) {
-      $output = '<a href="http://mollom.com" id="mollom-captcha"><img src="'. check_plain(url($response['url'])) .'" alt="Mollom CAPTCHA" /></a>';
-      $output .= ' (<a href="#" id="mollom-audio-captcha">'. t('play audio CAPTCHA') .'</a>)';
+      $output = '<a href="http://mollom.com" class="mollom-captcha"><img src="'. check_plain(url($response['url'])) .'" alt="Mollom CAPTCHA" /></a>';
+      $output .= ' (<a href="#" class="mollom-audio-captcha">'. t('play audio CAPTCHA') .'</a>)';
     }
   }
 
Index: mollom/mollom.js
===================================================================
--- mollom/mollom.js	(revision 35)
+++ mollom/mollom.js	(working copy)
@@ -1,41 +1,45 @@
 // $Id: mollom.js,v 1.2.2.5 2009/04/12 19:29:20 dries Exp $
 
-Drupal.behaviors.mollom = function() {
+Drupal.behaviors.mollom = function(context) {
   // Add onclick.event handlers for CAPTCHA links:
-  $('a#mollom-audio-captcha').click(getAudioCaptcha);
-  $('a#mollom-image-captcha').click(getImageCaptcha);
+  $('a.mollom-audio-captcha', context).click(getAudioCaptcha);
+  $('a.mollom-image-captcha', context).click(getImageCaptcha);
 }
 
 function getAudioCaptcha() {
+  var context = $(this).parents('.form-item').parent();
+  
   // Extract the Mollom session ID from the form:
-  var mollomSessionId = $("input#edit-mollom-session-id").val();
+  var mollomSessionId = $('input.mollom-session-id', context).val();
 
   // Retrieve an audio CAPTCHA:
   var data = $.get(Drupal.settings.basePath + 'mollom/captcha/audio/' + mollomSessionId,
     function(data) {
      // When data is successfully loaded, replace
      // contents of captcha-div with an audio CAPTCHA:
-     $('a#mollom-captcha').parent().html(data);
+     $('a.mollom-captcha', context).parent().html(data);
 
      // Add an onclick-event handler for the new link:
-     $('a#mollom-image-captcha').click(getImageCaptcha);
+     $('a.mollom-image-captcha', context).click(getImageCaptcha);
    });
    return false;
 }
 
 function getImageCaptcha() {
+  var context = $(this).parents('.form-item').parent();
+  
   // Extract the Mollom session ID from the form:
-  var mollomSessionId = $('input#edit-mollom-session-id').val();
+  var mollomSessionId = $('input.mollom-session-id', context).val();
 
   // Retrieve an image CAPTCHA:
   var data = $.get(Drupal.settings.basePath + 'mollom/captcha/image/' + mollomSessionId,
     function(data) {
      // When data is successfully loaded, replace
      // contents of captcha-div with an image CAPTCHA:
-     $('a#mollom-captcha').parent().html(data);
+     $('a.mollom-captcha', context).parent().html(data);
 
      // Add an onclick-event handler for the new link:
-     $('a#mollom-audio-captcha').click(getAudioCaptcha);
+     $('a.mollom-audio-captcha', context).click(getAudioCaptcha);
    });
    return false;
 }
