
$.fn.ajaxSubmit = function(e, callback, validate_callback) {
	/* Change a form's submission type to ajax */
	this.submit(function(){
	    try {
	        if ( typeof( validate_callback ) == 'function' ) {
	            if ( ! validate_callback( this ) ) {
	                return false;
				}
			}
			var params = {};
			$(this)
			.find("input[checked], input[type='text'], input[type='hidden'], input[type='password'], input[type='submit'], option[selected], textarea")
			.filter(":isEnabled")
			.each(function() {
				params[ this.name || this.id || this.parentNode.name || this.parentNode.id ] = this.value;
			});
			$("body").addClass("curWait");

			$.postJSON(this.getAttribute("action") + "?ajax", params, callback);
		} catch (e) {
            alert (e);
		}
		return false;
	});

	return this;
}
