//--onloadでの初期化
function city_select_init() {
	lrgEnable_quarter();
	quarter_change();
}

//--都市選択表示時の初期化
function ShowCity(CalSelect) {
	document.getElementById("CityWin").style.display = "block";
	document.frmPopupCity.CityElementID.value=CalSelect;
	lrgEnable_quarter();
	quarter_change();
}


//--方面選択表示
function lrgEnable_quarter() {
	var obj=document.frmPopupCity.select_quarter.options;
	obj[0]=new Option("方面を選択してください");
	obj[0].value="";
	var cnt=1;
	for( var i in area_quarter_array ) {
		obj[cnt]=new Option(area_quarter_array[i]);
		obj[cnt].value=i;
		cnt++;
	}
	obj[0].selected=true;
	if(document.layers) {
		window.resizeBy(-10,-10);
		window.resizeBy(10,10)
	}
}

//--国選択表示
function lrgEnable_country(condi) {
	if(condi == true) {
		var obj=document.frmPopupCity.select_country.options;
		obj[0]=new Option("国を選択してください");
		obj[0].value="";
		document.frmPopupCity.select_country.disabled = true;
		obj[0].selected=true;
		if(document.layers) {
			window.resizeBy(-10,-10);
			window.resizeBy(10,10)
		}
	}else{
		document.frmPopupCity.select_country.disabled = false;
	}
}

//--都市選択表示
function lrgEnable_city(condi) {
	if(condi == true) {
		var obj=document.frmPopupCity.select_city.options;
		obj[0]=new Option("都市を選択してください");
		obj[0].value="";
		document.frmPopupCity.select_city.disabled = true;
		obj[0].selected=true;
		if(document.layers) {
			window.resizeBy(-10,-10);
			window.resizeBy(10,10)
		}
	}else{
		document.frmPopupCity.select_city.disabled = false;
	}
}


//--方面選択処理
function quarter_change(area) {
	lrgEnable_country(false);
	lrgEnable_city(true);
	var obj=document.frmPopupCity.select_country.options;
	obj.length=0;
	var cnt=0;
	if(area_country_array[area]==null){
		lrgEnable_country(true);
		lrgEnable_city(true);
		obj[cnt]=new Option("国を選択してください");
		obj[cnt].value="";
	}else{
		obj[cnt]=new Option("国を選択してください");
		obj[cnt].value="";
		cnt++;
		for( var i in area_country_array[area] ){
			if (area_country_array[area][i]=="not_country_area"){
				lrgEnable_city(true);
				obj[cnt]=new Option("国を選択してください");
				obj[cnt].value="";
				break;
			}else{
				obj[cnt]=new Option(area_country_array[area][i]);
				obj[cnt].value=i;
			}
			cnt++;
		}
	}
	obj[0].selected=true;
	if(document.layers){
		window.resizeBy(-10,-10);
		window.resizeBy(10,10)
	}
}

//--国選択処理
function country_change(area){
	lrgEnable_city(false);
	var obj=document.frmPopupCity.select_city.options;
	obj.length=0;
	var cnt=0;
	if(area_city_array[area]==null){
		lrgEnable_city(true);
		obj[cnt]=new Option("都市を選択してください");
		obj[cnt].value="";
	}else{
		obj[cnt]=new Option("都市を選択してください");
		obj[cnt].value="";
		cnt++;
		for( var i in area_city_array[area] ){
			if (area_city_array[area][i]=="not_city_area"){
				lrgEnable_city(true);
				obj[cnt]=new Option("都市を選択してください");
				obj[cnt].value="";
				break;
			}else{
				obj[cnt]=new Option(area_city_array[area][i]);
				obj[cnt].value=i;
			}
			cnt++;
		}
	}
	obj[0].selected=true;
	if(document.layers){
		window.resizeBy(-10,-10);
		window.resizeBy(10,10)
	}
}

//--都市選択処理
function city_change(area){
}


//--都市決定
function city_decide(){
	var setId = document.frmPopupCity.CityElementID.value;
	if ( document.frmPopupCity.select_city.value == "" ) {
		alert("都市を選択してください");
	}
	else {
		document.getElementById(setId).value = document.frmPopupCity.select_city.value;
		document.getElementById("CityWin").style.display = "none";
	}
}

//--都市決定(ホテル絞込み検索用)
function city_decide_hotel_reserch(){
	var setId = document.frmPopupCity.CityElementID.value;
	if ( document.frmPopupCity.select_city.value == "" ) {
		alert("都市を選択してください");
	}
	else {
		document.getElementById(setId).value = document.frmPopupCity.select_city.value;
		document.getElementById("CityWin").style.display = "none";
		//--地区データ取得サーブレットの呼び出し
		document.frmPopupCity.action = "./MakeSectionList";
		document.frmPopupCity.submit();
	}
}

//--都市決定(航空券用)
function city_decide_airticket(){
	if ( document.frmPopupCity.select_city.value == "" ) {
		alert("都市を選択してください");
	}
	else {
		window.opener.document.frmFlight.txtArrivalCityCD.value = document.frmPopupCity.select_city.value;
		window.close();
	}
}

//--都市決定(ホテル用)
function city_decide_hotel(){
	if ( document.frmPopupCity.select_city.value == "" ) {
		alert("都市を選択してください");
	}
	else {
		window.opener.document.frmHotel.txtLodgmentplace.value = document.frmPopupCity.select_city.value;
		window.close();
	}
}

//--都市決定(ダイナミック用)
function city_decide_dynamic(){
	if ( document.frmPopupCity.select_city.value == "" ) {
		alert("都市を選択してください");
	}
	else {
		window.opener.document.frmDynamic.ArrivalCityCD.value = document.frmPopupCity.select_city.value;
		window.close();
	}
}

function city_decide(strFormName, strObjName){
	if ( document.frmPopupCity.select_city.value == "" ) {
		alert("都市を選択してください");
	}
	else {
		window.opener.document.forms[strFormName].elements[strObjName].value = document.frmPopupCity.select_city.value;
		if (window.opener.document.forms[strFormName].elements[strObjName].onchange != null) {
			window.opener.document.forms[strFormName].elements[strObjName].onchange();
		}
		window.close();
	}
}
