var sortArray;
var sortpath;
//id|name|parent|position|islink|linkurl|childs
function showSortTree(sorts)
{
	ar = sorts.split('*');
	sortArray = new Array(ar.length);
	for(var i=0;i<ar.length;i++)
	{
		var sort=ar[i].split('|');
		sortArray[i]=sort;
	}
	sortpath=GetPath(sortid)+sortid.toString()+'|';
	document.write('<div id="tree" style="top: 35px; left: 0px;" class="treeDiv">');
	document.write('<div id="treeRoot" onselectstart="return false" ondragstart="return false">');
	FillTree(0,0);
	document.write('</div>');
	document.write('</div>');
}
function FillTree(parent,depth)
{
	for(var i=0;i<sortArray.length;i++)
	{
		var s='';
		var a=sortArray[i];
		if ( parseInt(a[3])==parseInt(parent) )
		{
			//for(var i=0;i<depth;i++)
			var sStyle = 'treeUnselected';
			if (a[1]==sortid) sStyle='treeSelected';
			if(isstatic)
				s=s+' <a href=/s'+a[1]+'_1.shtml class="'+sStyle+'">'+a[2]+'</a>';// onclick="clickAnchor(this)"
			else
				s=s+' <a href=list.aspx?sort='+a[1]+' class="'+sStyle+'">'+a[2]+'</a>';// onclick="clickAnchor(this)"
			//document.write(s+'<br>');
			if (parseInt(a[7])!=0)//¶ù×ÓÊý
			{
				document.write('<div class="treeNode">');
				if (sortpath.indexOf('|'+a[1].toString()+'|')!=-1)
				{
					document.write('<img src="/images/treenodeminus.gif" class="treeLinkImage" onclick="expandCollapse(this.parentNode)" />');
					document.write(s);
					document.write('<div class="treeSubnodes">');
				}
				else
				{
					document.write('<img src="/images/treenodeplus.gif" class="treeLinkImage" onclick="expandCollapse(this.parentNode)" />');
					document.write(s);
					document.write('<div class="treeSubnodesHidden">');
				}
				FillTree(a[1],depth+1);
				document.write('</div>');
				document.write('</div>');
			}
			else
			{
				if ( parseInt(a[3])!=0)
				{
					document.write('<div class="treeNode">');
					document.write('<img src="/images/treenodedot.gif" class="treeNoLinkImage" />');
					document.write(s);
					document.write('</div>');
				}
				else
				{
					document.write('<div class="treeNode">');
					document.write('<img src="/images/treenodeplus.gif" class="treeNoLinkImage1" />');
					document.write(s);
					document.write('</div>');
				}
			}
		}
	}
}
function GetPath(selectedSortid)
{
	var s='';
	var a = GetASort(selectedSortid);
	if (a==null)return;
	while(a[3]!=0)
	{
		a = GetASort(a[3]);
		if(a==null)return s;
		s = a[1].toString()+'|'+s;
	}
	return '|'+s;
}
function GetASort(id)
{
	for(var i=0;i<sortArray.length;i++)
	{
		var a=sortArray[i];
		if (parseInt(a[1])==id)
			return a;
	}
	return null;
}