﻿County = new Array("請選擇 ","台灣地區","大陸地區");

Zone = new Array(3);

Zone[0]= new Array();

Zone[1] = new Array("臺北市", "基隆市", "臺北縣", "宜蘭縣", "新竹市", 
"新竹縣", "桃園縣", "苗栗縣", "臺中市", "臺中縣", "彰化縣","南投縣", "嘉義市","嘉義縣","雲林縣","臺南市","臺南縣",
"高雄市", "高雄縣", "澎湖縣", "屏東縣", "臺東縣", "花蓮縣","金門縣", "連江縣");

Zone[2] =new Array("上海市", "山西省", "山東省", "內蒙古自治區", "天津市", "北京市", "四川省", "甘肅省", "吉林省",
"安徽省", "江西省", "江蘇省", "西藏自治區", "河北省", "重慶市", "香港特別行政區", "海南省", "浙江省", "陜西省",
"湖北省", "湖南省", "雲南省", "黑龍江省", "新疆維吾爾自治區", "寧夏回族自治區", "福建省", "廣西壯族自治區",
"廣東省", "澳門特別行政區", "遼寧省", "珠海");

function initCounty(countyInput){
	countyInput.length = County.length;
	for (i = 0; i < County.length; i++){
		if(i==0){
			countyInput.options[i].value = "";
		}else{
			countyInput.options[i].value = County[i];
		}
		countyInput.options[i].text = County[i];
	}
	countyInput.selectedIndex = 0;
}

function initCounty2(countyInput,countyValue){	
	initCounty(countyInput);
	for(i = 0; i < countyInput.length; i++) {
		if (countyValue == countyInput[i].value)
		countyInput.selectedIndex = i;
	}
}

function initZone(countyInput, zoneInput){
	changeZone(countyInput, zoneInput);
}

function initZone2(countyInput, zoneInput,zoneValue){
	selectedCountyIndex = countyInput.selectedIndex;
	zoneInput.length = Zone[selectedCountyIndex].length;
	for (i = 0; i < Zone[selectedCountyIndex].length; i++) {
		zoneInput.options[i].value = Zone[selectedCountyIndex][i];
		zoneInput.options[i].text = Zone[selectedCountyIndex][i];
		if (zoneValue == Zone[selectedCountyIndex][i]){
			zoneInput.selectedIndex = i;
		}
	}
}

function changeZone(countyInput, zoneInput) {
	selectedCountyIndex = countyInput.selectedIndex;
	zoneInput.length = Zone[selectedCountyIndex].length;

	for (i = 0; i < Zone[selectedCountyIndex].length; i++) {
		zoneInput.options[i].value = Zone[selectedCountyIndex][i];
		zoneInput.options[i].text = Zone[selectedCountyIndex][i];
	}
	zoneInput.selectedIndex = 0;
}

