var area_arr=[["1","济南","0"],["2","青岛","0"],["3","历下区","1"],["4","市中区","1"],["5","四方区","2"]];
function GetTree(pid,sepStr){
	var retValue,i,tempArr;
	var tempArr=area_arr	;	
	for (var i=0;i<tempArr.length;i++){
		if(tempArr[i][2]==pid){			
			retValue+="<option value=\""+tempArr[i][0]+"\">"+sepStr+tempArr[i][1]+"</option>";
			if(parseInt(tempArr[i][0])!=0){				
				retValue+=GetTree(tempArr[i][0],"&nbsp;├");
			}			
		}		
	}
	return retValue;
}

function GetFirst(cid,sepStr){
	var retValue,i,tempArr,sele;
	var tempArr=area_arr	;	
	for (var i=0;i<tempArr.length;i++){
		if(tempArr[i][2]==0){			
			if(parseInt(tempArr[i][0])==parseInt(cid)){				
				sele="selected";
			}else{
				sele="";
			}
			retValue+="<option value=\""+tempArr[i][0]+"\""+sele+">"+sepStr+tempArr[i][1]+"</option>";				
		}		
	}
	return retValue;
}

function GetChilds(pid,cid,did){
	var retValue,i,tempArr,sele;
	var tempArr=area_arr	;	
	var childs=document.getElementById(did);
	childs.length=0;
	childs.options[0]=new Option('不限',0);	
	for (var i=0;i<tempArr.length;i++){
		if(parseInt(tempArr[i][2])==parseInt(pid)){
			var ofs=childs.length;
			childs.options[ofs]=new Option(tempArr[i][1],tempArr[i][0]);	
			if(parseInt(cid)==parseInt(tempArr[i][0])){
				childs.options[ofs].selected=true;
			}
		}		
	}
	
}