	function init () {
		 var forum = document.getElementById("forum");
		 if ( forum == null ) return;
		 var coll = forum.getElementsByTagName("DIV");
		 if ( coll == null ) return;
		 for (i=0; i<coll.length; i++) {
			var ch = coll[i].childNodes;
			var size = coll[i].getElementsByTagName("DIV");

			for (j=0; j<ch.length; j++) {
				if (ch[j].className == "title") {
					if (size.length > 0) {
						ch[j].onclick = collapse;
						ch[j].style.cursor = "hand";
					}
					else {
						ch[j].id = "empty";
					}
				} else if ( ch[j].id == 'num' ) {
					if ( size.length > 0 ) {
						ch[j].innerText = '('+size.length+')';
					}
				}
			}
		}
	}

	function collapse () {
		var dv = this.parentNode;
		var coll = dv.childNodes;
		// прячем детей
		if (dv.className == "active") {
			for (i=0; i<coll.length; i++) {
				if (coll[i].tagName == "DIV") {
					coll[i].className = "";
				}
			}
			dv.className = "close";
			this.id = "";
		}	
		// показываем детей
		else {
			for (i=0; i<coll.length; i++) {
				if (coll[i].tagName == "DIV") {
					coll[i].className = "open";
				}
			}
			dv.className = "active";
			this.id = "open";
		}
	}

	function show (what) {
		var coll = document.getElementById("forum").getElementsByTagName("DIV");

		if (what.checked) {
			for (i=0; i<coll.length; i++) {
				coll[i].id = "show";
				var ch = coll[i].childNodes;
				for (j=0; j<ch.length; j++) {
					if (ch[j].className == "title") {
						ch[j].onclick = blank;
						ch[j].style.cursor = "";
					}
				}
			}
		}
		else {
			for (i=0; i<coll.length; i++) {
				coll[i].id = "";
				var ch = coll[i].childNodes;
				var size = coll[i].getElementsByTagName("DIV");
				if (size.length > 0 ) {
					for (j=0; j<ch.length; j++) {
						if (ch[j].className == "title") {
							ch[j].onclick = collapse;
							ch[j].style.cursor = "hand";
						}
					}	
				}
			}
		}
	}

	function blank () {}


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

	function loadForm (url) {
		var features = "resizable=yes,scrollbars=yes,toolbar=0,status=0,width=450,height=300";
		w = window.open (url, "win", features);
		w.focus();
	}

