
function CCommonTree()
{
	CCommonTree_Constructor(this);
}

function CCommonTree_Constructor(_this)
{
	_this.m_nId = 0;
	_this.m_nLevel = 0;
	_this.m_arLeafs = new Array();

	_this.SetLeaf = CLeaf_SetLeaf;
	_this.GetLeaf = CLeaf_GetLeaf;
	_this.GetLeafsLength = CLeaf_GetLeafsLength;
	_this.RemoveLeaf = CLeaf_RemoveLeaf;
}

function CLeaf_SetLeaf(obj, bAdded)
{
	this.m_arLeafs[this.m_arLeafs.length] = obj;
	if(!bAdded) obj.SetParent(this, true);
}

function CLeaf_GetLeaf(n)
{
	return this.m_arLeafs[n];
}

function CLeaf_GetLeafsLength()
{
	return this.m_arLeafs.length;
}

function CLeaf_RemoveLeaf(n)
{
	ar = new Array();
	if(this.m_arLeafs[n])
	for(m=0, z=0; m<this.m_arLeafs.length; m++)
		if(m != n) ar[z++] = this.m_arLeafs[m];
	this.m_arLeafs = ar;
}

