/*
       Name : zone.js
            :
     Author : 卓立民 Alex Chuo
            : alexchuo@iii.org.tw
            :
  Copyright : (c) 1999 Institute for Information Industry
            : All Rights Reserved
            :
    Purpose :*從 Browser 端讓使用者可以透過下拉式的選單方式來選擇 鄉鎮市區
            : 代碼
            :
            :
    Version : 1.25
            :
            :
       Last :
     Update : 2003/2/19 04:28PM
            :
            :
    Modifier: Alex Chuo(卓立民)
    History : =============================================================
        1.0 : First Deployed Version
            :
        1.1 : 因應 1999/10/4 樹林升格
            : 更改 台→臺
            :      汐止鎮→汐止市
            :      樹林鎮→樹林市
            :      蘆洲鄉→蘆洲市
            : 刪除 太平鄉
            :
        1.2 : 2001/3/1 05:45PM
            : 刪除 有2個戶所的資料
            :
        1.21: 2002/4/13 03:08PM
            : 更改：旗山「鄉」→旗山「鎮」
            :
        1.22: 2002/6/21 11:37AM
            : 更改：大「理」市→大「裡」市
            :
        1.23: 2002/9/27 03:59PM
            : 更改：潮州「鄉」→潮州「鎮」
            :
        1.24: 2002/10/18 09:10AM
            : 因應 2002 年底高雄市三民區戶所分所 (參考問題單: QRRL911009-02; 變更單: CRXX911016-08)
            :
        1.25: 22003/2/19 03:19PM
            : *修正彰化縣埤頭鄉(10007220)代碼錯誤
            : 由 10007210(田尾鄉) → 10007220 (參考問題單: QRAW920219-01)
            : *修正台南縣山上鄉(10011220)代碼錯誤
            : 由 10011210(安定鄉) → 10011220
            : *修正高雄縣甲仙鄉(10012220)代碼錯誤
            : 由 10012210(六龜鄉) → 10012220
            : *修正屏東縣霧臺鄉(10013220)代碼錯誤
            : 由 10013210(三地門鄉) → 10013220
            :
      NOTES :

*/
function initHosp(HospInput){
	HospInput.length = Hosp.length;
	for (i = 0; i < Hosp.length; i++) {
		HospInput.options[i].value = Hosp[i];
		HospInput.options[i].text = Hosp[i];
	}
	HospInput.selectedIndex = 0;
}

function initCat(HospInput, CatInput, codeInput){
	changeCat(HospInput, CatInput, codeInput);
}

function changeCat(HospInput, CatInput, codeInput) {
	selectedHospIndex = HospInput.selectedIndex;

	CatInput.length = Cat[selectedHospIndex].length;
	for (i = 0; i < Cat[selectedHospIndex].length; i++) {
		CatInput.options[i].value = Cat[selectedHospIndex][i];
		CatInput.options[i].text = Cat[selectedHospIndex][i];
	}
	CatInput.selectedIndex = 0;

	showCode(HospInput, CatInput, codeInput);
}

function showCode(HospInput, CatInput, codeInput) {
	codeInput.value = ZoneCode[HospInput.selectedIndex][CatInput.selectedIndex];
}

Hosp = new Array("不限","大醫院","診所","其他醫療單位");

Cat = new Array(4);
Cat[0]=new Array("不限");
Cat[1] = new Array("無");
Cat[2] = new Array("內科","眼科","牙科","骨科","小兒科","婦產科","家醫科","復健科","皮膚科","神經科","精神科","泌尿科","耳鼻喉科","中醫","獸醫");
Cat[3] = new Array("醫療用品","藥局","檢驗所","中藥行","輔具","坐月子中心","護理之家");



ZoneCode = new Array(4);
//臺北縣
ZoneCode[0] = new Array("10001011","10001012","10001021",
			"10001022","10001031","10001032","10001040",
			"10001050","10001060","10001070","10001080","10001090",
			"10001100","10001110","10001120","10001130","10001140",
			"10001150","10001160","10001170","10001180","10001190",
			"10001200","10001210","10001220","10001230","10001240",
			"10001250","10001260","10001270","10001280","10001290");
//宜蘭縣
ZoneCode[1] = new Array("10002010","10002020","10002030","10002040","10002050",
			"10002060","10002070","10002080","10002090","10002100",
			"10002110","10002120");
//桃園縣
ZoneCode[2] = new Array("10003010","10003020","10003030","10003040","10003050",
			"10003060","10003070","10003080","10003090","10003100",
			"10003110","10003120","10003130");
//新竹縣

