var clearChildren = function(obj) {
	var kids = Dom.getChildren(obj);
	for(var i=0;i<kids.length;i++) {
		kids[i].parentNode.removeChild(kids[i]);
	}
}

// This is the breadCrumb object, it needs passed the container to render to (as an object) and the items array
var breadCrumb = function(container, items) {
	this.container = container;
	this.items = items;
	this.backNavs = new Array();
	
	this.count = function() { return this.backNavs.length }
	
	this.draw = function() {
		this.container.innerHTML = "";
		
		for(var i=0;i<this.items.length;i++) {
			this.backNavs[this.backNavs.length] = new backNav(this.items[i]);
			if(i!=this.items.length-1) {
				breakArrow = document.createElement("img");
				breakArrow.setAttribute("src","/breadcrumb/navigate_right.png");
				breakArrow.setAttribute("align","top");
				breakArrow.setAttribute("width","16");
				breakArrow.setAttribute("height","21");
				this.container.appendChild(breakArrow);
			}
		}
	}
	
	// Create an object of backNav items, which contain both the button to go back, and tue sub menu to the right...
	var backNav = function(itm) {
		this.itm = itm;
		this.id = this.itm.id;
		this.container = container;

		var oSplitButton = new YAHOO.widget.Button({	type: "split",
												   		label: this.itm.display,
														name: this.itm.id + "SplitButton",
														menu: this.itm.items,
														container: this.container });
		if(itm.url) oSplitButton.on("click", function () { location.href = itm.url; });

	}	
}










