(function () {
	
	// re-enable after the form validation
	$(document).on('invalid-form.validate', 'form', function () {
		var button = $(this).find('input[type="submit"]');

		button.removeAttr('disabled');
	});

	// disable multiple form submitions
	$(document).on('submit', 'form', function () {
	    var buttons = $(this).find('input[type="submit"],button[type="submit"]');

	    buttons.each(function() {
	        if ($(this).val() != "Cancel") {
	            $(this).attr('disabled', 'disabled');
	        }
	    });
	});
})();

