$(document).ready(function(){
  
  $('form').submit(function() {
    if(typeof jQuery.data(this, "disabledOnSubmit") == 'undefined') {
      jQuery.data(this, "disabledOnSubmit", {submitted:true});
      $('input[type=submit], input[type=button], input[type=image]', this).each(function() {
         $(this).attr('disabled', 'disabled');
      });
      return true;
    }
    else {
      return false;
    }
  });
});

