
var station = new Array(); 
/* [0]name, [1]category, [2]area, [3]pref, [4]markKEY, [5]markValue */
station[0] = new Array("東京駅","010203","04","13","mark4","ST1342");
station[1] = new Array("上野駅","0102","04","13","mark3","ST1341");
station[2] = new Array("大宮駅","0102","03","11","mark1","ST0782");
station[3] = new Array("宇都宮駅","01","03","09","mark1","ST0538");
station[4] = new Array("郡山駅","01","02","07","mark2","ST0337");
station[5] = new Array("福島駅","01","02","07","mark1","ST0336");
station[6] = new Array("仙台駅","01","02","04","mark2","ST0269");
station[7] = new Array("古川駅","01","02","04","mark1","ST0268");
station[8] = new Array("一ノ関駅","01","02","03","mark2","ST0246");
//station[9] = new Array("北上駅","01","02","03"," "," ");
station[10] = new Array("盛岡駅","01","02","03","mark1","ST0242");
station[11] = new Array("八戸駅","01","02","02","mark1","ST0219");
station[12] = new Array("秋田駅","01","02","05","mark1","ST0325");
station[13] = new Array("山形駅","01","02","06","mark2","ST0331");
station[14] = new Array("米沢駅","01","02","06","mark1","ST0327");

station[15] = new Array("熊谷駅","02","03","11","mark2","ST0783");
station[16] = new Array("高崎駅","02","03","10","mark1","ST0645");
station[17] = new Array("長岡駅","02","05","15","mark1","ST2328");
station[18] = new Array("燕三条駅","02","05","15","mark2","ST2329");
station[19] = new Array("新潟駅","02","05","15","mark3","ST2330");
station[20] = new Array("佐久平駅","02","05","20","mark1","ST2493");
station[21] = new Array("長野駅","02","05","20","mark2","ST2500");

station[21] = new Array("品川駅","03","04","13","mark5","ST1343");
station[22] = new Array("新横浜駅","03","03","14","mark1","ST1963");
station[23] = new Array("三島駅","03","06","22","mark1","ST2516");
station[24] = new Array("新富士駅","03","06","22","mark2","ST2517");
station[25] = new Array("静岡駅","03","06","22","mark3","ST2518");
station[26] = new Array("浜松駅","03","06","22","mark4","ST2520");
station[27] = new Array("豊橋駅","03","06","23","mark1","ST2572");
station[28] = new Array("名古屋駅","03","06","23","mark2","ST2574");
station[29] = new Array("米原駅","03","08","25","mark1","ST2769");
station[30] = new Array("京都駅","03","08","26","mark1","ST2896");
station[31] = new Array("新大阪駅","03","08","27","mark1","ST3131");
station[32] = new Array("新神戸駅","03","08","28","mark1","ST3682");
station[33] = new Array("西明石駅","03","08","28","mark2","ST3683");
station[34] = new Array("姫路駅","03","08","28","mark3","ST3684");
station[35] = new Array("岡山駅","03","09","33","mark1","ST4457");
station[36] = new Array("福山駅","03","09","34","mark1","ST4519");
station[37] = new Array("新尾道駅","03","09","34","mark2","ST4520");
station[38] = new Array("三原駅","03","09","34","mark3","ST4521");
station[39] = new Array("東広島駅","03","09","34","mark4","ST4522");
station[40] = new Array("広島駅","03","09","34","mark5","ST4523");
station[41] = new Array("新山口駅","03","09","35","mark1","ST4561");
station[42] = new Array("小倉駅","03","11","40","mark1","ST4637");
station[43] = new Array("博多駅","03","11","40","mark2","ST4638");
station[44] = new Array("新八代駅","03","11","43","mark1","ST4674");
station[45] = new Array("鹿児島中央駅","03","11","46","mark2","ST4678");






var airport = new Array(); 
/* [0]name, [1]category, [2]area, [3]pref, [4]markKEY, [5]markValue */
airport[0] = new Array("新千歳空港","01","01","01","mark1","AP0001");
airport[1] = new Array("旭川空港","01","01","01","mark3","AP0003");
airport[2] = new Array("女満別空港","01","01","01","mark7","AP0007");
airport[3] = new Array("釧路空港","01","01","01","mark6","AP0006");
airport[4] = new Array("帯広空港","01","01","01","mark8","AP0008");
airport[5] = new Array("函館空港","01","01","01","mark2","AP0002");

airport[6] = new Array("青森空港","02","02","02","mark1","AP0014");
airport[7] = new Array("三沢空港","02","02","02","mark2","AP0015");
airport[8] = new Array("花巻空港","02","02","03","mark1","AP0016");
airport[9] = new Array("秋田空港","02","02","05","mark1","AP0018");
airport[10] = new Array("仙台空港","02","02","04","mark1","AP0017");

airport[11] = new Array("羽田空港","03","04","13","mark1","AP0073");
airport[12] = new Array("成田空港","03","03","12","mark1","AP0023");

airport[13] = new Array("中部国際空港","04","06","23","mark1","AP0031");
airport[14] = new Array("新潟空港","04","05","15","mark1","AP0026");
airport[15] = new Array("小松空港","04","07","17","mark1","AP0028");
//airport[16] = new Array("富山空港","04"," "," "," "," ");

airport[17] = new Array("伊丹空港","05","08","27","mark1","AP0033");
airport[18] = new Array("関西空港","05","08","27","mark2","AP0034");
airport[19] = new Array("神戸空港","05","08","28","mark1","AP0035");

airport[20] = new Array("広島空港","06","09","34","mark1","AP0043");
airport[21] = new Array("岡山空港","06","09","33","mark1","AP0042");
airport[22] = new Array("鳥取空港","06","09","31","mark1","AP0037");
airport[23] = new Array("米子空港","06","09","31","mark2","AP0038");
airport[24] = new Array("石見空港","06","09","32","mark2","AP0040");
airport[25] = new Array("山口宇部空港","06","09","35","mark1","AP0045");
airport[26] = new Array("高松空港","06","10","37","mark1","AP0047");
airport[27] = new Array("松山空港","06","10","38","mark1","AP0048");
airport[28] = new Array("高知空港","06","10","39","mark1","AP0049");

airport[29] = new Array("福岡空港","07","11","40","mark1","AP0050");
airport[30] = new Array("北九州空港","07","11","40","mark2","AP0051");
airport[31] = new Array("長崎空港","07","11","42","mark1","AP0053");
airport[32] = new Array("熊本空港","07","11","43","mark1","AP0058");
airport[33] = new Array("大分空港","07","11","44","mark1","AP0059");
airport[34] = new Array("宮崎空港","07","11","45","mark1","AP0060");
airport[35] = new Array("鹿児島空港","07","11","46","mark1","AP0061");

airport[36] = new Array("那覇空港","08","12","47","mark1","AP0069");
airport[37] = new Array("石垣島空港","08","12","47","mark3","AP0071");
airport[38] = new Array("宮古島空港","08","12","47","mark2","AP0070");






function sfStation(box) {
	
	var selectedLine = box.options[box.selectedIndex].value;
	// alert(selectedLine);
	
	var stationList = '<select id="stList" name="stList" onchange="sfStaSelect(this)"><option value="" disabled="disabled" selected="selected">↓駅をお選びください。</option>';
	
	for(i=0;i<station.length;i++){
		
		var data = 	station[i];
		
		if(!data) {
			continue;	
		}
		
		var stationCat = station[i][1];
		var stationName = station[i][0];
		if (stationCat.indexOf(selectedLine) >= 0) {
			stationList = stationList+'<option value="'+stationName+'">'+stationName+'</option>';	
		}
		
	}
	
	//alert(document.getElementById('stList').innerHTML);
	//alert(stationList);
	
	document.getElementById('sePlace02').innerHTML = stationList+'</select>';
	
}


function sfStaSelect(box) {

	var selectedSta = box.options[box.selectedIndex].value;
	//alert(selectedSta);
	
	for(i=0;i<station.length;i++){
		
		var data = 	station[i];
		
		if(!data) {
			continue;	
		}
		
		
		if (selectedSta == station[i][0]) {
			document.getElementById('seArea').innerHTML = '<input type="hidden" name="area" value="'+ station[i][2] +'" />';
			document.getElementById('sePref').innerHTML = '<input type="hidden" name="pref" value="'+ station[i][3] +'" />';
			document.getElementById('seMark').innerHTML = '<input type="hidden" name="'+ station[i][4] +'" value="'+ station[i][5] +'" />';
		}
		
	}
	
}





function sfAirport(box) {
	
	var selectedArea = box.options[box.selectedIndex].value;
	//alert(selectedArea);
	
	var airportList = '<select id="apList" name="apList" onchange="sfAirSelect(this)"><option value="" disabled="disabled" selected="selected">↓空港をお選びください。</option>';
	
	for(i=0;i<airport.length;i++){

		var data = 	airport[i];
		
		if(!data) {
			continue;	
		}

		
		var airportCat = airport[i][1];
		var airportName = airport[i][0];
		if (airportCat.indexOf(selectedArea) >= 0) {
			airportList = airportList+'<option value="'+airportName+'">'+airportName+'</option>';	
		}
		
	}
	
	document.getElementById('saPlace02').innerHTML = airportList+'</select>';
	
}


function sfAirSelect(box) {

	var selectedAp = box.options[box.selectedIndex].value;
	//alert(selectedAp);
	
	for(i=0;i<airport.length;i++){
		
		var data = 	airport[i];
		
		if(!data) {
			continue;	
		}
		
		if (selectedAp == airport[i][0]) {
			document.getElementById('saArea').innerHTML = '<input type="hidden" name="area" value="'+ airport[i][2] +'" />';
			document.getElementById('saPref').innerHTML = '<input type="hidden" name="pref" value="'+ airport[i][3] +'" />';
			document.getElementById('saMark').innerHTML = '<input type="hidden" name="'+ airport[i][4] +'" value="'+ airport[i][5] +'" />';
		}
		
	}
	
}



function saIniSet() {
	document.safExp.railLine[0].selected = true;	
	document.safAir.apArea[0].selected = true;
	
	document.safExp.stList[0].selected = true;	
	document.safAir.apList[0].selected = true;
}




















