function simple_ajax_command (uri, post_data, success_callback, post_content_type)
{
	function ajax_callback (xmldoc) {
		if (xmldoc.documentElement.nodeName == "error")
			alert(xmldoc.documentElement.firstChild.data);
		else if (success_callback)
			success_callback();
		//alert(xmldoc.firstChild.nextSibling.firstChild.nextSibling.firstChild.data);
	}

	var	ajax = new ajax_requester(ajax_callback);

	if (typeof(post_data) == "string")
		ajax.post(uri, post_content_type ? post_content_type : "application/x-www-form-urlencoded", post_data);
	else if (typeof(post_data) == "object") {
		var	data = "";
		for (var name in post_data)
			data += "&" + name + "=" + encodeURIComponent(post_data[name]);
		ajax.post(uri, "application/x-www-form-urlencoded", data.substr(1));
	} else
		ajax.get(uri);
}

function toggle_class (target, class_name)
{
	if (has_class(target, class_name))
		remove_class(target, class_name);
	else
		add_class(target, class_name);
}

function set_class_if (target, class_name, condition)
{
	if (condition)
		add_class(target, class_name);
	else
		remove_class(target, class_name);
}

function count_checked_boxes (form, checkbox_name)
{
	var count = 0;
	for_each(form.elements, function() { if (this.name == checkbox_name && this.checked) ++count; });
	return count;
}

function count_checked_boxes_by_value (form, checkbox_className, checkbox_value)
{
	var count = 0;
	for_each(form.elements, function() { if (this.className == checkbox_className && this.value == checkbox_value && this.checked) ++count; });
	return count;
}
