// JavaScript Documentfunction 
var h3addul=document.getElementById("colnums_nav").childNodes;
var arrh3=new Array();
var arrul=new Array();

for(var i=0; i<h3addul.length; i++){
	if(h3addul[i].tagName=="H3"){
		arrh3.push(h3addul[i]);
	}else if(h3addul[i].tagName=="UL"){
		arrul.push(h3addul[i]);		
	}
}

for(i=0;i<arrh3.length;i++){
	arrh3[i].son=arrul[i];
	chah3(arrh3[i]);
	arrh3[i].onclick=function(){
		chah3(this);
	}
}

function chah3(h3obj){
	if(h3obj=="all"){
		sfh3 = document.getElementById("colnums_nav").getElementsByTagName("h3");
		for (var i=0; i<sfh3.length; i++) {
			chah3(sfh3[i]);
		}
	}else{
		if(vho(h3obj.son)){
			h3obj.className="h3z";
		}else{
			h3obj.className="h3s";
		}
	}
}

var sfli = document.getElementById("colnums_nav").getElementsByTagName("li");

for (var i=0; i<sfli.length; i++) {
	var isson = sfli[i].getElementsByTagName("ul");
	if(isson.length==0){
		sfli[i].className="isfolder";
	}else{
		isson[0].style.display='none'
		sfli[i].getElementsByTagName("h4")[0].son=sfli[i].getElementsByTagName("ul")[0];
	}
}
var sfh4 = document.getElementById("colnums_nav").getElementsByTagName("h4");
for (var i=0; i<sfh4.length; i++) {
	sfh4[i].onclick=function(){
		if(vho(this.son)){
			this.className="h4now";
		}else{
			this.className="";
		}
	}
}

function vnow(str){
	var sful = document.getElementById("colnums_nav").getElementsByTagName("h2");
	for (var i=0; i<sful.length; i++) {
		//if(sful[i].innerHTML.indexOf(">"+str+"<")!=-1){
		if(str!=null && str.indexOf(sful[i].id)!=-1){
			sful[i].className="h2now";
		}
	}
	
	var sfh3 = document.getElementById("colnums_nav").getElementsByTagName("h3");
	for (var i=0; i<sfh3.length; i++) {
		//if(sfli[i].son.innerHTML.indexOf(">"+str+"<")!=-1){
		if(str!=null && str.indexOf(sfh3[i].id)!=-1){
			sfh3[i].son.style.display="block";
			/**将一级栏目的加号变成打开状态*/
			sfh3[i].className="h3z";
			
			var sfli = document.getElementById("colnums_nav").getElementsByTagName("li");
			for (var i=0; i<sfli.length; i++) {
				var isson = sfli[i].getElementsByTagName("ul");
				//if(isson.length!=0&&isson[0].innerHTML.indexOf(">"+str+"<")!=-1){
				if(isson.length!=0&&isson[0].innerHTML.indexOf(str)!=-1){
					var issnow = isson[0].getElementsByTagName("li");
					for(var j=0;j<issnow.length;j++){
						if(issnow[j].innerHTML.indexOf(">"+str+"<")!=-1){
							issnow[j].className="this_now";
						}
					}
					isson[0].style.display='block'
					sfli[i].getElementsByTagName("h4")[0].className="h4now";
				//}else if(isson.length==0&&sfli[i].innerHTML.indexOf(">"+str+"<")!=-1){
				}else if(isson.length==0&&sfli[i].id==str){
					sfli[i].className="this_now";
				}
			}
			
		}
	}
	

}
//展开所有二级页
//chah3("all");
