	function node( id, name, depth, parent, description ){
		this.id = id;
		this.label = name.replace("&amp;squot;","'");
		this.children = [];
		this.depth = depth;
		this.index = 0;
		this.parent = parent;
		this.selected = false;
		this.expanded = false;
		this.description = description;
	}
	function Node_appendNewNode( id, name, depth, description ) {
		var aNode = new node(id, name, depth, this, description);
		this.appendChild(aNode);
		return aNode;
	}
	function Node_appendChild( node ){
		this.children[this.children.length] = node;
		node.parent = this;
		return node;
	}
	function Node_hasChildren(){ 
	    //alert('Checking children' + this.children.length);
		return (this.children.length != 0);
	}
	function Node_isOnlyChild(){
		return (this.parent == null || this.parent.children.length == 0);
	}
	function Node_isFirstChild(){
		return (this.parent == null || this.parent.children[0] == this);
	}
	function Node_isLastChild(){
		return (this.parent == null || this.parent.children[this.parent.children.length-1] == this);
	}
	/* Search the tree for the specified node */
	function Node_selectNode( id ){
	    //alert('Selecting node');
		if( this.id + '' == id + ''){
			return this;
		} else {
			for( var iChild = 0; iChild < this.children.length; iChild++ ){
				var node = this.children[iChild].selectNode( id );
				if( node != null ) return node;
			}
		}
		return null;
	}

	/* Prototypes for Node methods */
	node.prototype = new Object();
	node.prototype.appendChild = Node_appendChild;
	node.prototype.hasChildren = Node_hasChildren;
	node.prototype.isOnlyChild = Node_isOnlyChild;
	node.prototype.isFirstChild = Node_isFirstChild;
	node.prototype.isLastChild = Node_isLastChild;
	node.prototype.selectNode = Node_selectNode;
	node.prototype.appendNewNode = Node_appendNewNode;
	
