/**
 * Enable ajax processing of the Poll form.
 * @require jquery.js
 * @author bbarber@i2rd.com
 */
jQuery(function($){

    $("div.scriptingbean .poll_actions button").live("click", function(e){
      var form   = $(e.target).closest("form");
      var url    = "/partial" + form.attr("action");
      var params = form.serialize() + "&" + $(e.target).attr('name'); 
      $.post(url, params, function(data, status){
        if (status == "success") {
          form.closest(".scriptingbean").replaceWith(data);
        } else {
          alert("I'm sorry, we are unable to process your poll response at this time. Please try again later."); 
        }
      });
      e.preventDefault();
    });

});


