<!--

/*
Description:

	jQuery Collapsible List Sample. How to create a collapsible list using jQuery

Usage:

	$(window).load(
		function()
		{
			// get collapsible list
			$("ul.collapsible").each(
				function()
				{
					iterateList(this);
				}
			);
		}
	);

*/
function iterateList(node)
{
	var ul, toggleLink;
	// get list items
	$("li",node).each(
		function()
		{
			if(this.parentNode != node) return;
			// if item contains a sub list
			ul = $("ul",this).get(0);
			if(ul)
			{
				$("ul",this).hide();
				toggleLink = document.createElement("a");
				toggleLink.href = "#";
				$(toggleLink).addClass("toggle");
				$(ul.parentNode.childNodes[0]).wrap(toggleLink);
				$("a.toggle", ul.parentNode).click(
					function()
					{
						$(">ul",this.parentNode).toggle();
						return false;
					}
				);
				iterateList(ul);
			}
		}
	);
}
//-->
