function ajaxSubmit(form, url) {
	if ($('activity_indicator') != null) $('activity_indicator').title = 'hidden';
	
	var idx = '';
	if (arguments.length >= 4) idx = arguments[3];

	var successAction = null;
	if (arguments.length >= 3) successAction = arguments[2];
	
	$('button' + idx).setStyle('display', 'none');
	$('loader' + idx).setStyle('display', 'inline');
	$(form).set('send', {
		method: 'post',
		url: url,
		onComplete: function(t) {
			if ($('activity_indicator') != null) $('activity_indicator').title = '';
			
			$('button' + idx).setStyle('display', 'inline');
			$('loader' + idx).setStyle('display', 'none');
			var status = t.replace(/^\s+|\s+$/g, '');
			if (status == 'ok' && successAction != null) successAction();
			if (status != 'ok') alert(status);
		}
	});
	$(form).send();
}

function preload() {
	var img = new Array();
	for (var i = 0; i < arguments.length; i++) {
		img[i] = new Image();
		img[i].src = arguments[i];
	}
}

function leveledHeight(selector) {
	var maxHeight = 0;
	$$(selector).each(function(elem) {
		if (maxHeight < elem.getSize().y)
			maxHeight = elem.getSize().y;
	});
	$$(selector).setStyle('height', maxHeight);
}