var from = document.go.from;
var to = document.go.to;
var q,w,e;
from.citys = [];
for(q in city){
	for(w in shedule){
		e = shedule[w].from;
		if(in_array(e, from.citys)) continue;
		var option = newElem('option');
		from.appendChild(option);
		option.value = e;
		option.innerHTML = city[e].name;
		from.citys.push(e);
	}
}
from.onchange = function(){
	to.value = 0;
	if(this.value == 0){
		to.disabled = true;
	}else{
		to.disabled = false;
		while(to.childNodes.length>1)
			to.removeChild(to.lastChild);
		to.citys = [];
		for(q in city){
			for(w in shedule){
				if(shedule[w].from != from.value) continue;
				e = shedule[w].to;
				if(in_array(e, to.citys)) continue;
				var option = newElem('option');
				to.appendChild(option);
				option.value = e;
				option.innerHTML = city[e].name;
				to.citys.push(e);
			}
		}
	}
}
from.onchange();
function in_array(whot, where){
	for(var i in where)
		if(whot == where[i]) return true;
	return false;
}
function newElem(name, className, id){
	var ele = document.createElement(name);
	if(className) ele.className = className;
	if(id) ele.id = id;
	return ele;
}
