
	var id_name;
	var id;
	var http_request=false;

	function set_id_name(dd){
		id_name=dd;
	}
	function set_id(dd){
		id=dd;
	}


    function send_request(url){
		http_request=false;
		if(window.XMLHttpRequest){
		 http_request=new XMLHttpRequest();
		 if(http_request.overrideMimeType){
		   http_request.overrideMimeType("text/xml");
		 }
		}
		else if(window.ActiveXObject){
			 try{
				  http_request=new ActiveXObject("Msxml2.XMLHttp");
			 }catch(e){
				  try{
				  http_request=new ActiveXobject("Microsoft.XMLHttp");
				  }catch(e){}
			 }
		}
		if(!http_request){
			 window.alert("创建XMLHttp对象失败！");
			 return false;
		}
		http_request.onreadystatechange=processrequest;
		
		http_request.open("GET",url,true);
		http_request.send(null);
  }
  
  function processrequest(){
	if(http_request.readyState==4){
		if(http_request.status==200){
	
			var string = http_request.responseText;
			
		
			if(string!="")
			{
				var arr = string.split(',');
				document.getElementById(id_name).options.length=0;
				
				//var ff = document.createElement("option");
				//		 ff.value = 0;
				//		 ff.text= "Please Choose";
				//document.getElementById(id_name).options.add(ff);
				
				for(i=0;i<arr.length;i++)
				{
					var ss = document.createElement("option");
					if(arr[i]!="")
					{
						 var arr2 = arr[i].split(':');
						 ss.value = arr2[0];
						 ss.text= arr2[1];
						 document.getElementById(id_name).options.add(ss);
					}

				}
			 }
		}
		else{
			 alert("您所请求的页面不正常！");
		}
   }
  }
  function getchild(obj,id){
	set_id_name(id);
	var ss = document.createElement("option");
			 ss.value = "loading。。。";
			 ss.text= "loading。。。";
	var sa = document.createElement("option");
			 ss.value = "";
			 ss.text= "無";
	var pid=document.getElementById(obj).value;
	if(pid!=0){
		document.getElementById(id_name).options.add(ss);
		document.getElementById(id_name).options.length=0;
		var url = doc_dir+'/lib/js/ajax_php/ajax_get_child.php?pid='+pid;
		url += "&tmp=" + Math.random();
		send_request(url);
		reobj=obj;
	}
  }
