function getobj(fuc_name)
{
	return document.getElementById(fuc_name);
}	

function changeclass(fuc_str)
{
	
}

function showsub(fuc_obj)
{
	var tempno;
	var tempobj;
	var tempstr;
	var tempstr1;
	var tempstrfront;
	var tempstrback;
	var temparray;
	var temparrayhtml;
	var selected;
	var selectedhtml;
	var N_ladder;
	var replaceed;
	
	N_ladder=getobj("N_ladder");
	temparrayhtml=N_ladder.innerHTML;
	selectedhtml=fuc_obj.innerHTML;
	//hid all sub
	tempstr1=/sub_selected2|sub_selected/g;
	temparrayhtml=temparrayhtml.replace(tempstr1,"sub");
	tempstr1=/root_selected/g;
	temparrayhtml=temparrayhtml.replace(tempstr1,"root_");
	
	//show the sub
	temparray=new Array();
	while(true)
	{
		pos1=(temparrayhtml.indexOf("root_"));
		if(pos1<0)
		{
			temparray[temparray.length]=temparrayhtml;
			break;
		}
		tempstrfront=temparrayhtml.substring(0,pos1+5);
		tempstrback=temparrayhtml.substring(pos1+5,temparrayhtml.length);
		temparray[temparray.length]=tempstrfront;
		temparrayhtml=tempstrback;
	}
	temparrayhtml="";
	replaceed=false;
	for(tempno=0;tempno<temparray.length;tempno++)
	{
		if(temparray[tempno].indexOf(selectedhtml)>0&&replaceed==false)
		{
			tempstr1=/root_/g;
			temparray[tempno-1]=temparray[tempno-1].replace(tempstr1,"root_selected");
			tempstr1=/sub/g;
			temparray[tempno]=temparray[tempno].replace(tempstr1,"sub_selected");
			replaceed=true;
		}
		temparrayhtml += temparray[tempno];
	}
	N_ladder.innerHTML=temparrayhtml;
	//temparray=tempobj.getElementByName("li");
}

function showselected()
{
	var tempno;
	var tempobj;
	var tempstr;
	var tempstr1;
	var tempstrfront;
	var tempstrmid;
	var tempstrback;
	var temparray;
	var temparrayhtml;
	var selected;
	var selectedhtml;
	var N_ladder;
	var replaceed;
	
	var httphead=location.href;
	var InfoIDpos=0;
	var InfoIDpos2=0;
	var InfoIDlen=0;
	var InfoIDsign="GeneralContentShow_DocID";
	var InfoIDsign2="DocParentFoldID";
	
	var InfoID="";
	//httphead=location.href;
	InfoIDpos=httphead.indexOf(InfoIDsign);
	InfoIDpos2=httphead.indexOf(InfoIDsign2);
	if(InfoIDpos>0)
	{
	InfoIDlen=httphead.length;
	InfoID=httphead.substring(InfoIDpos+InfoIDsign.length+1,InfoIDpos+InfoIDsign.length+33);
	}
	else
	{
		if(InfoIDpos2>0)
		{
		InfoIDlen=httphead.length;
		InfoID=httphead.substring(InfoIDpos2+InfoIDsign2.length+1,InfoIDpos2+InfoIDsign2.length+33);
		}
		else
		{
			return;
		}
	}
	N_ladder=getobj("N_ladder");
	temparrayhtml=N_ladder.innerHTML;
	//hid all sub
	tempstr1=/sub_selected2|sub_selected/g;
	temparrayhtml=temparrayhtml.replace(tempstr1,"sub");
	tempstr1=/root_selected/g;
	temparrayhtml=temparrayhtml.replace(tempstr1,"root_");

	
	temparray=new Array();
	while(true)
	{
		pos1=(temparrayhtml.indexOf("root_"));
		if(pos1<0)
		{
			temparray[temparray.length]=temparrayhtml;
			break;
		}
		tempstrfront=temparrayhtml.substring(0,pos1+5);
		tempstrback=temparrayhtml.substring(pos1+5,temparrayhtml.length);
		temparray[temparray.length]=tempstrfront;
		temparrayhtml=tempstrback;
	}
	temparrayhtml="";
	replaceed=false;
	for(tempno=0;tempno<temparray.length;tempno++)
	{
		if(temparray[tempno].indexOf(InfoID)>0&&replaceed==false)
		{
			tempstr1=/root_/g;
			temparray[tempno-1]=temparray[tempno-1].replace(tempstr1,"root_selected");
			tempstr1=/sub/g;
			temparray[tempno]=temparray[tempno].replace(tempstr1,"sub_selected");
			replaceed=true;
			
			pos1=temparray[tempno].indexOf(InfoID);
			tempstrfront=temparray[tempno].substring(0,pos1-100);
			tempstrmid=temparray[tempno].substring(pos1-100,pos1);
			tempstrback=temparray[tempno].substring(pos1,temparray[tempno].length);
			tempstrmid=tempstrmid.replace("sub_selected","sub_selected2");
			temparray[tempno]=tempstrfront+tempstrmid+tempstrback;
		}
	}
	for(tempno=0;tempno<temparray.length;tempno++)
	{
		temparrayhtml += temparray[tempno];
	}
	N_ladder.innerHTML=temparrayhtml;
}