
Navigation = Class.create({
	initialize: function(element)
	{
		this.element = $(element);
		this.id = this.element.id;
		if(this.element == null){
			alert('Error: Navigation - Could not find element "' + element + '"');
			return null;
		}
		this._init();
	},
	_init: function(){
		var listElement = $(this.id + "_children");
		this._runOnAllItems(listElement, this._initItem);
		this._initNav();
	},
	_runOnAllItems: function(list, func, order){
		order = order == "FIFO" ? "FIFO" : "FILO";
		var listElement = list.firstChild;
		while(listElement != null){
			var tName = listElement.tagName;
			var id = listElement.id;
			if(tName != undefined){
				if(order == "FILO"){
					var c = $(id + "_children");
					if(c != null)
						this._runOnAllItems(c, func, order);
				}
				func.call(this, listElement);
				if(order == "FIFO"){
					var c = $(id + "_children");
					if(c != null)
						this._runOnAllItems(c, func, order);
				}
			}
			listElement = listElement.nextSibling;
		}
	},
	closeItem: function(item){
		var c = $(item.id + "_children");
		if(c != null)
			c.style.display = "none";
	},
	openItem: function(item){
		var c = $(item.id + "_children");
		if(c != null)
			c.style.display = "block";
	},
	_initNav: function(){},
	_initItem: function(item){}
});
