/*
 * Provided with the Spring Ajax simplication sample.
 * 
 * Modified it to use $j instead of $ to prevent conflict wiht Prototype.
 */
$j.fn.serializeObject = function() {
	var o = {};
	var a = this.serializeArray();
	$j.each(a, function() {
		if (o[this.name]) {
			if (!o[this.name].push) {
				o[this.name] = [o[this.name]];
			}
			o[this.name].push(this.value || '');
		} else {
			o[this.name] = this.value || '';
		}
	});
	return o;
};

/*
 * Provided with the Spring Ajax simplication sample.
 * 
 * Modified it to use $j instead of $ to prevent conflict wiht Prototype.
 */
$j.postJSON = function(url, data, callback, errorCallback) {
    return jQuery.ajax({
        'type': 'POST',
        'url': url,
        'contentType': 'application/json',
        'data': JSON.stringify(data),
        'dataType': 'json',
        'success': callback,
        'error': errorCallback
    });
};

