
function CHtmlTree()
{
	CHtmlTree_Constructor(this);
}

function CHtmlTree_Constructor(_this)
{
	CTree_Constructor(_this);

	_this.m_bExpanded = true;

	_this.DrawTree = CHtmlTree_DrawTree;
	_this.DrawLeafs = CHtmlTree_DrawLeafs;
}

function CHtmlTree_DrawTree(HtmlTree, bShowLoading, nAdminId)
{
	HtmlTree.innerHTML = "<table border=0 cellspacing=0 cellpadding=0 class=rtwChunksCss width='100%'>"+
				this.DrawLeafs(this, true, "", bShowLoading, nAdminId)+"</table>";
}

function CHtmlTree_DrawLeafs(p, bLast, sTreeLine, bShowLoading, nAdminId)
{
	if(p.Draw) 
	{
		if(!bShowLoading) p.m_bIsLoading = false;
		s = p.Draw(bLast, sTreeLine, nAdminId);
	}
	else s = "";
	if(bLast) sTreeLine += '<img src="History/Tree/Images/space.gif" align=left>';
	else sTreeLine += '<img src="History/Tree/Images/line.gif" align=left>';

	if(p.m_bExpanded)
		for(var l=0; l<p.m_arLeafs.length;)
			s += this.DrawLeafs(p.m_arLeafs[l], ++l==p.m_arLeafs.length, sTreeLine, bShowLoading, nAdminId);
	return s;
}
