// JavaScript Document
var ajax=false;
function Ajax()
{
	if(window.XMLHttpRequest){
		ajax = new XMLHttpRequest();
	}else if(window.ActiveXObject){
		try {
			ajax = new ActiveXObject('Msxml2.XMLHttp');
		} catch (e) {
			try {
				ajax = new ActiveXObject(Microsoft.XMLHttp);
			} catch (e) {}
		}
	}
	if(!ajax) {
		window.alert('不能创建实例!');
		return false;
	}
}
function fill()
{
	Ajax();
	ajax.onreadystatechange = fillcity;
	var id = document.getElementById('select1').value;
	var url = "select.php?fid="+id+"&time="+new Date().getTime();
//	alert(url);
	ajax.open("GET",url,true);
	ajax.send(null);
}
function fillcity()
{
	if(ajax.readyState == 4) {
		if(ajax.status == 200) {
			splitcity(ajax.responseText);
		}else {
			alert('No Data Come Back!');
		}
	}
}
function splitcity(rs)
{
	document.getElementById('sortid').length =0;
	field = rs.split(';');
	for(var i=0;i<field.length;i++){
		var op = field[i].split(',');
		if(op[0] != ''){
		document.getElementById("sortid").options[document.getElementById("sortid").length]= new Option(op[0], op[1]);
		}
	}
}

function selectQiye(){//添加目的地
	var id = document.getElementById("sortid").value;
    
    var url = "../card.php?cd_id="+id+"&tt_id=31&time="+new Date().getTime();
    createXMLHttpRequest();
    xmlHttp.onreadystatechange = handleStateChange;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);		
}
