Index: advpoll-vote.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advpoll/advpoll-vote.js,v
retrieving revision 1.1.2.10
diff -u -p -r1.1.2.10 advpoll-vote.js
--- advpoll-vote.js	8 Sep 2007 20:50:23 -0000	1.1.2.10
+++ advpoll-vote.js	3 Dec 2007 21:32:46 -0000
@@ -8,7 +8,6 @@ if (typeof(Drupal) == "undefined" || !Dr
 * Submit advpoll forms with ajax
 */
 Drupal.advpoll.attachVoteAjax = function() {
-  var submitSelect = "input[@value="+ Drupal.settings.advPoll.vote +"]";
   $("form.advpoll-vote").each(function() {
     var thisForm = this;
     var options = {
@@ -27,18 +26,13 @@ Drupal.advpoll.attachVoteAjax = function
           $(data.response).insertBefore(thisForm);
         }
 
-        // Re-enable the Vote button if there was an error message
-        $(submitSelect, thisForm).removeAttr("disabled");
+        // Re-enable the Vote button, in case there was an error message.
+        $(".form-submit", thisForm).removeAttr("disabled");
 
       },
       before: function() {
-        // Disable all voting forms for this poll
-        var nid = $("input.edit-nid", thisForm).val();
-        $("form.advpoll-vote").each(function() {
-          if ($("input.edit-nid", this).val() == nid) {
-            $(submitSelect, this).attr("disabled", "disabled");
-          }
-        });
+        // Disable the Vote button.
+        $(".form-submit", thisForm).attr("disabled", "disabled");
       }
     };
     // Tell the server we are passing the form values with ajax and attach the function
Index: advpoll.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advpoll/advpoll.module,v
retrieving revision 1.21.2.81
diff -u -p -r1.21.2.81 advpoll.module
--- advpoll.module	3 Dec 2007 12:54:25 -0000	1.21.2.81
+++ advpoll.module	3 Dec 2007 21:54:34 -0000
@@ -720,14 +720,16 @@ function advpoll_view($node, $teaser = F
     // Previewing a node, so display voting form instead of results.
     $poll = drupal_get_form('advpoll_voting_'. _advpoll_get_mode($node->type) .'_form', $node, $teaser, $page, $status);
   }
-  else if (!$node->voted && arg(2) != 'results' && ($status == 'open' || $status == 'pending')) {
-    // User hasn't voted, we're not on the results tab and poll is open or opening in the future.
+  else if ((!$node->voted && arg(2) != 'results' && ($status == 'open' || $status == 'pending')) || $_POST['op'] == 'Vote') {
+    // User hasn't voted, we're not on the results tab and poll is open or
+    // opening in the future. Also, we check the $_POST array if the user tried
+    // to submit a vote, so we can validate and give an error if the user has
+    // already voted on the poll.
     $poll = drupal_get_form('advpoll_voting_'. $node->mode .'_form', $node, $teaser, $page, $status);
 
     static $add_js = TRUE;
     if ($add_js) {
       // Add javascript for posting voting forms with Ajax.
-      drupal_add_js(array('advPoll' => array('vote' => t('Vote'))), 'setting');
       drupal_add_js(drupal_get_path('module', 'advpoll') .'/advpoll-vote.js', 'module');
       drupal_add_js(drupal_get_path('module', 'advpoll') .'/jquery.form.js', 'module');
       $add_js = FALSE;
Index: modes/binary.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advpoll/modes/binary.inc,v
retrieving revision 1.7.2.31
diff -u -p -r1.7.2.31 binary.inc
--- modes/binary.inc	2 Dec 2007 18:53:44 -0000	1.7.2.31
+++ modes/binary.inc	3 Dec 2007 21:36:31 -0000
@@ -236,6 +236,9 @@ function advpoll_voting_binary_form_vali
   list($voted, $cancel_vote) = _advpoll_user_voted($node->nid);
   if ($voted) {
     _advpoll_form_set_error('choice[', t('You have already voted in this poll.'), $ajax);
+    // Redirect to the current poll node to refresh the poll. This is only
+    // initiated for non-Ajax voting.
+    drupal_goto('node/'. $node->nid);
   }
 
   if ($node->max_choices == 1) {
Index: modes/ranking.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advpoll/modes/ranking.inc,v
retrieving revision 1.8.2.36
diff -u -p -r1.8.2.36 ranking.inc
--- modes/ranking.inc	2 Dec 2007 18:53:44 -0000	1.8.2.36
+++ modes/ranking.inc	3 Dec 2007 21:09:49 -0000
@@ -679,6 +679,9 @@ function advpoll_voting_ranking_form_val
   list($voted, $cancel_vote) = _advpoll_user_voted($node->nid);
   if ($voted) {
     _advpoll_form_set_error('choice[', t('You have already voted in this poll.'), $ajax);
+    // Redirect to the current poll node to refresh the poll. This is only
+    // initiated for non-Ajax voting.
+    drupal_goto('node/'. $node->nid);
   }
 
   // Array used to check which values are set.
