Пример #1
0
			for (var i in node.childNodes) {
				if (node.childNodes[i].nodeName !== "UL") continue;
				for (var j in node.childNodes[i].childNodes)
					toggle(actn, node.childNodes[i].childNodes[j], lvls - 1);
			}
		}

		function toggleHandler(e) {
			if (e.which != 1 || e.target.className.indexOf("excol") == -1) return;

			var node = e.target.parentNode,
				actn = node.className.indexOf("collapsed") !== -1 ? 1 : 0,
				lvls = e.shiftKey ? 1000 : 1;

			toggle(actn, node, lvls);

			// toggle all following siblings
			if (e.ctrlKey) {
				while (node.nextSibling) {
					node = node.nextSibling;
					toggle(actn, node, lvls);
				}
			}
		}

		document.addEventListener("click", toggleHandler, false);
	})();
</script>
<?php 
dump_r::$js = ob_get_contents();
ob_end_clean();