document.write('<style id="GE_ToggleListStyleEl" type="text/css">.directory{position:relative;top:0;left:-10000px;height:350px;}</style>');
GE_Main.addInitFn(  function() { $("GE_ToggleListStyleEl").remove(); });

GE_Main.mapCSSToFn("directory",function(el){
	var headings = $(el).getElementsBySelector(".has_children");
	headings.each( function(el) {
		new GE_ToggleList(el);
	});
});

function GE_ToggleList(el) {
	this._open = false;
	this.hEl = $(el);
	this.aEl = this.hEl.down();
	this.aEl.setAttribute('title','click to expand');
	this.ulEl = this.hEl.next("ul");
	this.hEl.observe("click", this.toggle.bind(this));
	this.close();
}

GE_ToggleList.prototype.toggle = function(e) {
	e.stop();
	(this._open) ? this.close() : this.open();
}

GE_ToggleList.prototype.open = function() {
	this.hEl.removeClassName("collapsed");
	this.hEl.addClassName("expanded");
	this.aEl.setAttribute('title','click to collapse');
	this.ulEl.show();
	this._open = true;
}

GE_ToggleList.prototype.close = function() {
	this.hEl.removeClassName("expanded");
	this.hEl.addClassName("collapsed");
	this.aEl.setAttribute('title','click to expand');
	try {
	this.ulEl.hide();
	}
	catch(e) {
	alert(this.hEl.innerHTML);
	}
	this._open = false;
}
