

function treeMode1Class(){
	this.rootId=null;
	this.rootName=null;
	this.rootObj=null;
	var rootText=null;
	
	this.del=function(menuid){
		delObj=document.getElementById("treeNode"+menuid);
		delObj.removeNode(true);
	}
	
	this.add=function(idList,onclick){
		if (this.rootId!=0){
			
			return false;
		}
		
		if (this.rootObj==null){
				alert("请在程序中指明把树放在哪个对象中"+this.rootObj);
				return false;
		}
		//alert(idList)
		var i=1;
		var upObj=null;
		if (idList[0][2]==this.rootid+""){
			i=1;
			this.rootName=idList[0][1];
			upObj=this.rootObj;

		}else{
			if (idList[1][2]==idList[1][5]){
				this.rootId=0;
				this.rootName="根";
				upObj=this.rootObj;
				i=0
			}else{
				i=1
				upObj=document.getElementById("treeNodeDown"+idList[0][2]);
			}
		}
		
		if (rootText==null){
			var tempObj=document.createElement("div");
			obj=this.rootObj.appendChild(tempObj);
			obj.id="rootText";
			obj.menuid=this.rootId;
			obj.innerText=this.rootName;
			obj.onclick=function(){
				try{
					myWeb.menuid=this.menuid;
					myWeb.readMenu(this.menuid);
				}catch(e) {}
			}
			rootText=obj;
		}
		if (i!=0){
			var downObj=document.getElementById("treeNodeDown"+idList[0][2]);
			if (downObj!=null){
				downObj.style.display="block";
			}
		}
//id,mName,mid,layer,isDown,uplistid,intro,indexNum,mDate,asTab
		for (i;i<idList.length-1;i++){
			var textObj=document.getElementById("treeNodeText"+idList[i][2]);
			if (textObj==null){
				tempObj=document.createElement("div");
				var tObj=upObj.appendChild(tempObj);
				tObj.id="treeNode"+idList[i][2];
				tObj.className="treeNode"
				
				tempObj=document.createElement("div");
				textObj=tObj.appendChild(tempObj);
				textObj.id="treeNodeText"+idList[i][2];
				textObj.menuid=idList[i][2];
				textObj.idList=idList[i][5];
				textObj.asTab=idList[i][9];
				textObj.className="textNode";
				if (onclick==null){onclick=""}
				textObj.onclickText=onclick;
				
				tempObj=document.createElement("div");
				downObj=tObj.appendChild(tempObj);
				downObj.id="treeNodeDown"+idList[i][2];
				downObj.style.display="none";
				
				textObj.onclick=function(){
					var downObj=document.getElementById("treeNodeDown"+this.menuid);
					var objType=document.getElementById("treeNodeType"+this.menuid);
					if (downObj.style.display=="none"){
						downObj.style.display="block";
						if (this.onclickText==""){
							myWeb.menuid=this.menuid;
							myWeb.readMenu(this.menuid);
						}else{
							eval(this.onclickText)
						}
						if (objType!=null){
							objType.className="downNode_1";
						}
					}else{
						if (this.onclickText==""){
							myWeb.menuid=this.menuid;
							myWeb.readMenu(this.menuid);
						}else{
							eval(this.onclickText)
						}

						downObj.style.display="none";
						downObj.style.display="none";
						if (objType!=null){
							objType.className="downNode";
						}
					}

				}
				
				textObj.onmouseover=function(){
					this.className=this.className+"_1";
				}
				
				textObj.onmouseout=function(){
					var c=this.className.split("_");
					c=c[0];
					this.className=c;
				}
				
			}
			var s=idList[i][5].split(",");
			var sp="";
			for (var x=0;x<s.length;x++){
				sp=sp+"<span style='width:20px;height:10px;'></span>"
			}
			if (idList[i][4]=="1"){
				textObj.innerHTML=sp+"<span id='treeNodeType"+idList[i][2]+"' class='downNode'></span><span class='treeIco'></span><span>"+idList[i][1]+"</span>";
			}else{
				textObj.innerHTML=sp+"<span  class='notDownNode'> </span><span class='treeIco_1'></span><span>"+idList[i][1]+"</span>";
			}
		}
	}
}