var buf_kura;
function update_select(obj, next) {	// countryが届く
	var g = obj.options[obj.selectedIndex].value;
	if(next == undefined) {
		next = 'town';
	}
	
	var f = obj.form;
	var s = f[next];
	
	// bufにコピーされてなければまずコピー
	if(buf_kura == undefined) {
		buf_kura = new Array();
		for(var i=0 ; i<s.options.length ; i++) {
			buf_kura[i] = s.options[i];
		}
	}
	
	{
		s.options.length = 1;
		for(var i=1 ; i<buf_kura.length ; i++) {
			if(!buf_kura[i].value) {	// たぶんそんなことはない
				continue;
			}
			var country = buf_kura[i].country;
			if(!country) {
				country = buf_kura[i].getAttribute('country');
			}
			if(!country) {		// countryが未登録のtown
				continue;
			}
			if(g && g != country) {
				continue;
			}
			s.options.length++;
			s.options[s.options.length-1].text  = buf_kura[i].text;
			s.options[s.options.length-1].value = buf_kura[i].value;
		}
	}
}
