function ajaxSubmit(form, url) {
	if ($('activity_indicator') != null) $('activity_indicator').title = 'hidden';
	
	idx = '';
	if (arguments.length >= 4) idx = arguments[3];

	successAction = null;
	if (arguments.length >= 3) successAction = arguments[2];
	
	$('button' + idx).hide();
	$('loader' + idx).show();		
	new Ajax.Request(url, {
		parameters: Form.serialize($(form)),
		onComplete: function(t) {
			if ($('activity_indicator') != null) $('activity_indicator').title = '';
			
			$('button' + idx).show();
			$('loader' + idx).hide();
			status = t.responseText.replace(/^\s+|\s+$/g, '');
			if (status == 'ok' && successAction != null) successAction();
			if (status != 'ok') alert(status);
		}
	});
}
