function ycTree(id){
	var target = id;
	var sys_depth=1;
	var showId=null;
	this.init = function(depth){
		sys_depth=depth;
		initTree();
	};
	this.opento=function(sid){
		if(sid){
			showId=sid;
		}
		openNode();
	}
	
	function openNode(){
			v=document.getElementById("catalog"+showId);
			if(v){
				p=v.parentNode;
				t=p.tagName;
				a=v.getElementsByTagName("A");
				if(a.length>0){a[0].className='selectedTreeNode';}
				while(t=='LI'||t=='UL'){
					if(t=="LI"){
						ls=p.firstChild;
						if(ls.tagName=='FONT'){
							if(ls.className!='leaf'){
								ls.className="folder_open";
								u=ls.nextSibling;
								while(u.tagName!='UL'){
									u=u.nextSibling;
								}
								if(u.tagName=='UL'){
									u.style.display="";
								}
							}
						}
					}
					p=p.parentNode;
					t=p.tagName;
				}
			}
	}
	
	function initTree(){
		v=document.getElementById(target);
		if(v==undefined){
			return;	
		}
		opened=false;
		c=v.getElementsByTagName("li");
		for(i=0;i<c.length;i++){
			var u=c[i].getElementsByTagName("ul");
			var depth=c[i].getAttribute("depth")==undefined?0:parseInt(c[i].getAttribute("depth"));
			hitDiv=document.createElement("font");
			if(u.length>0){
				if(sys_depth<depth){
					u[0].style.display="none";
					hitDiv.className="folder_closed";
				}else{
					opened=true;
					u[0].style.display="";
					hitDiv.className="folder_open";
				}
				addEvent(hitDiv);
			}else{
				hitDiv.className="leaf";
			}
			c[i].insertBefore(hitDiv,c[i].firstChild);
		}
	}
	function addEvent(obj){
		if( obj.attachEvent ){
			obj.attachEvent('onclick', function(){hide(obj);});
		} else {
			obj.addEventListener('click', function(){hide(obj);},false);
		}
	}
	function hide(o){
	var obj=o;
	var li=obj.parentNode;
	var u=li.getElementsByTagName("ul");
		if(u.length>0){
			if(u[0].style.display&&u[0].style.display=="none"){
				u[0].style.display="";
				obj.className="folder_open";
			}else{
				obj.className="folder_closed";
				u[0].style.display="none";
			}
		}
	}
}