function hideAll(what, context, tag) {
	var lists = new Array();
	if(context == "document") {
		var lists = getElementsByClassName(document, tag, what);
	} else {
		var lists = getElementsByClassName(document.getElementById(context), tag, what);
	}

	for(i = 0; i < lists.length; i++) {
		lists[i].style.display = "none";
	}

	return true;
}

function showStatusListbox(rid) {
	hideAll("listbox", "document", "div");

	document.getElementById("status_" + rid).style.display = "block";

	return true;
}

function hideStatusListbox(rid) {
	document.getElementById("status_" + rid).style.display = "none";

	return true;
}

function comboboxTextFocus(name) {
	if(document.getElementById(name).value != -1) {
		document.getElementById(name + "_combobox_button").focus();
		setTimeout("showCombobox('" + name + "_list');", 150);
	}
}

function showCombobox(id) {
	hideAll("combobox", "document", "div");

	document.getElementById(id).style.display = "block";

	return true;
}

function hideCombobox() {
	hideAll("combobox", "document", "div");
	return true;
}

function showCalendar(id) {
	hideAll("calendar", "document", "div");

	document.getElementById(id).style.display = "block";

	return true;
}

function hideCalendar() {
	hideAll("calendar", "document", "div");
	return true;
}

function filterChildCombo(id, filter) {
	var e = document.getElementById(id + "_list");
	var n = e.getElementsByTagName("div");

	for(i = 0; i < n.length; i++) {
		if(n[i].className.split(" ").indexOf(id + "_item_c" + filter) < 0 && n[i].className.split(" ").indexOf("new_item") < 0 && n[i].className.split(" ").indexOf("clear_item") < 0  && filter != "") {
			n[i].style.display = "none";
		} else {
			n[i].style.display = "block";
		}
	}

	return true;
}

function setComboColor(id, c) {

	switch (c) {
		case "new":
			document.getElementById(id + "_text").style.backgroundColor = "#efe";
			document.getElementById(id + "_text").style.borderRight = "1px solid #090";
			document.getElementById(id + "_text").readOnly = false;
			document.getElementById(id + "_text").focus();
			break;
		case "clear":
			document.getElementById(id + "_text").style.backgroundColor = "#fee";
			document.getElementById(id + "_text").style.borderRight = "1px solid #900";
			document.getElementById(id + "_text").readOnly = true;
			break;
		default:
			document.getElementById(id + "_text").style.backgroundColor = "#fff";
			document.getElementById(id + "_text").style.borderRight = "1px solid silver";
			document.getElementById(id + "_text").readOnly = true;
			break;
	}

	return true;
}

function showBox(id) {
	document.getElementById(id).style.display = "block";

	return true;
}

function statusBar(value) {
	document.getElementById("statbar_text").innerHTML = value;

	return true;
}