
function Cat(id,title,catId)
{
		this.id=id;
	  this.title=title;
	  this.catId=catId;
		this.cat= new Array();
		this.add =function(dr){
			this.cat[this.cat.length] =dr;
		}
		this.hasChild = function() {
			return this.cat.length>0;
		}
}

function CatTree()
{
	this.cat=new Array();
	this.root=new Cat("0","root");
	this.add = function(id,pId,title,catId) {
		this.cat[id]=new Cat(id,title,catId);
		if (pId==0){
			this.root.add(this.cat[id]);
		}
		else
			this.cat[pId].add(this.cat[id]);
	}
		
}

