/* attaches a hotkey to a field to submit the form */
(function($) {
	$.fn.submitKey = function(opts) {
		var defaults = {
			ctrlKey: true,
			keyCode: 13 // enter
		};
		var options = $.extend(defaults, opts);

		return this.live('keydown', function(e) {
			var form = $(this).closest('form').first();
			if (e.ctrlKey === options.ctrlKey && e.keyCode === options.keyCode) {
				if (form.find('input[type=submit]:disabled, button[type=submit]:disabled').length === 0) {
					form.submit();
				} else {
					return false;
				}
			}
		});
	};
})(jQuery);
