var iFrame = "top.IFrameExec";
var iFrame2 = "top.IFrameExec2";
//var iPath = "./../../CLM/ASPX/";
var iPath = "";
var iCategoryID = "";
var iCategoryType = "";
var iSearchFilter = "";
var iSortOrder = "";

function ArchivesList(CategoryID, CategoryType, PageNo, SortOrder) {
	if ((CategoryType.toLowerCase()=="key") && (document.getElementById("SearchHistory").value.length>0)) {
			SearchList("0", CategoryType, document.getElementById("SearchHistory").value, 0, SortOrder);
	}
	else {
		////if (document.location.href.toUpperCase().indexOf("CLMG00000.ASPX")>0) {
		//
		//if ((CategoryID == 0) || (CategoryID.indexOf(",") == 0)) {
		//	document.getElementById("TCGFAQ1_Research").style.display = "none";
		//}
		//else {
		//	document.getElementById("TCGFAQ1_Research").style.display = "";
		//}
		//
		if (SortOrder.length > 0) {
			if (iCategoryID != CategoryID) {
				if (SortOrder.toUpperCase().indexOf("DESC") >= 0) {
					iSortOrder = SortOrder;
				}
				else {
					iSortOrder = SortOrder + " DESC";
				}
			}
			else {	
				if (iSortOrder.indexOf(SortOrder) >= 0) {
					if (iSortOrder.toUpperCase().indexOf("DESC") >=0) {
						iSortOrder = SortOrder;
					}
					else {
						iSortOrder = SortOrder + " DESC"
					}
				}
				else {
					if (SortOrder.toUpperCase().indexOf("DESC") >= 0) {
						iSortOrder = SortOrder;
					}
					else {
						iSortOrder = SortOrder + " DESC"
					}
				}
			}
		}
		iCategoryID = CategoryID;
		iCategoryType = CategoryType;
		document.getElementById("SearchHistory").value = "";
		var iList = "CategoryID=" + iCategoryID + "&CategoryType=" + iCategoryType + "&PageNo=" + PageNo + "&SortOrder=" + iSortOrder;
		//alert(iList);
		//alert(iFrame2 + ".location.href = '" + iPath + "TCGGetArchives.aspx?" + iList + "'");
		eval(iFrame2 + ".location.href = '" + iPath + "TCGGetArchives.aspx?" + iList + "'");
		//eval(iFrame + ".location.href = '" + iPath + "TCGGetArchives.aspx?" + iList + "'");
		//}
	}
}


function ArchivesList9(CategoryID, CategoryType, PageNo, SortOrder) {
	if ((CategoryType.toLowerCase()=="key") && (document.getElementById("SearchHistory").value.length>0)) {
			SearchList("0", CategoryType, document.getElementById("SearchHistory").value, 0, SortOrder);
	}
	else {
		if (SortOrder.length > 0) {
			if (iCategoryID != CategoryID) {
				if (SortOrder.toUpperCase().indexOf("DESC") >= 0) {
					iSortOrder = SortOrder;
				}
				else {
					iSortOrder = SortOrder + " DESC";
				}
			}
			else {	
				if (iSortOrder.indexOf(SortOrder) >= 0) {
					if (iSortOrder.toUpperCase().indexOf("DESC") >=0) {
						iSortOrder = SortOrder;
					}
					else {
						iSortOrder = SortOrder + " DESC"
					}
				}
				else {
					if (SortOrder.toUpperCase().indexOf("DESC") >= 0) {
						iSortOrder = SortOrder;
					}
					else {
						iSortOrder = SortOrder + " DESC"
					}
				}
			}
		}
		iCategoryID = CategoryID;
		iCategoryType = CategoryType;
		parent.document.getElementById("SearchHistory").value = "";
		var iList = "CategoryID=" + iCategoryID + "&CategoryType=" + iCategoryType + "&PageNo=" + PageNo + "&SortOrder=" + iSortOrder;
		eval("location.href = '" + iPath + "TCGGetArchives.aspx?" + iList + "'");
	}
}



function ArchivesList2(CategoryID, CategoryType, PageNo, SortOrder) {
try {
	if ((CategoryType=="Key") && (document.getElementById("SearchHistory").value.length>0)) {
			SearchList2("0", CategoryType, document.getElementById("SearchHistory").value, 0, SortOrder);
	}
	else if (CategoryType=="Key") {
		document.getElementById("Panel2").style.display="none";
		document.getElementById("Panel6").style.display="none";
	}
	else {
		//if ((CategoryID == 0) || (CategoryID.indexOf(",") == 0)) {
		//	document.getElementById("TCGFAQ1_Research").style.display = "none";
		//}
		//else {
		//	document.getElementById("TCGFAQ1_Research").style.display = "";
		//}
		if (SortOrder.length > 0) {
			if (iCategoryID != CategoryID) {
				if (SortOrder.toUpperCase().indexOf("DESC") >= 0) {
					iSortOrder = SortOrder;
				}
				else {
					iSortOrder = SortOrder + " DESC";
				}
			}
			else {	
				if (iSortOrder.indexOf(SortOrder) >= 0) {
					if (iSortOrder.toUpperCase().indexOf("DESC") >=0) {
						iSortOrder = SortOrder;
					}
					else {
						iSortOrder = SortOrder + " DESC"
					}
				}
				else {
					if (SortOrder.toUpperCase().indexOf("DESC") >= 0) {
						iSortOrder = SortOrder;
					}
					else {
						iSortOrder = SortOrder + " DESC"
					}
				}
			}
		}
		iCategoryID = CategoryID;
		iCategoryType = CategoryType;
		//為了回上一頁時保留查詢關鍵字 Mark下列
		//document.getElementById("SearchHistory").value = "";
		var iList = "CategoryID=" + iCategoryID + "&CategoryType=" + iCategoryType + "&PageNo=" + PageNo + "&SortOrder=" + iSortOrder;
		eval(iFrame + ".location.href = '" + iPath + "\TCGGetArchives.aspx?" + iList + "'");	
		
	}
	}catch(e){
	}
}
function ArchivesList3(CategoryID, CategoryType, PageNo, SortOrder, SystemCode) {
	if ((CategoryType.toLowerCase()=="key") && (document.getElementById("SearchHistory").value.length>0)) {
			SearchList("0", CategoryType, document.getElementById("SearchHistory").value, 0, SortOrder);
	}
	else {
		//if (document.location.href.toUpperCase().indexOf("CLMG00000.ASPX")>0) {
		if ((CategoryID == 0) || (CategoryID.indexOf(",") == 0)) {
			document.getElementById("TCGFAQ1_Research").style.display = "none";
		}
		else {
			document.getElementById("TCGFAQ1_Research").style.display = "";
		}
		if (SortOrder.length > 0) {
			if (iCategoryID != CategoryID) {
				if (SortOrder.toUpperCase().indexOf("DESC") >= 0) {
					iSortOrder = SortOrder;
				}
				else {
					iSortOrder = SortOrder + " DESC";
				}
			}
			else {	
				if (iSortOrder.indexOf(SortOrder) >= 0) {
					if (iSortOrder.toUpperCase().indexOf("DESC") >=0) {
						iSortOrder = SortOrder;
					}
					else {
						iSortOrder = SortOrder + " DESC"
					}
				}
				else {
					if (SortOrder.toUpperCase().indexOf("DESC") >= 0) {
						iSortOrder = SortOrder;
					}
					else {
						iSortOrder = SortOrder + " DESC"
					}
				}
			}
		}
		iCategoryID = CategoryID;
		iCategoryType = CategoryType;
		document.getElementById("SearchHistory").value = "";
		var iList = "CategoryID=" + iCategoryID + "&CategoryType=" + iCategoryType + "&PageNo=" + PageNo + "&SortOrder=" + iSortOrder + "&SystemCode=" + SystemCode;
		
		eval(iFrame +".location.href = '" + iPath + "\TCGGetArchives2.aspx?" + iList + "'");
		
		//}
	}
}
function RelatedList(ArchivesItem, ListType, PageNo) {
	iList = "ArchivesItem=" + ArchivesItem + "&ListType=" + ListType + "&PageNo=" + PageNo;
	eval(iFrame + ".location.href = '" + iPath + "\TCGGetRelated.aspx?" + iList + "'");
}
function RelatedList2(ArchivesItem, ListType, PageNo, SystemCode) {
	iList = "ArchivesItem=" + ArchivesItem + "&ListType=" + ListType + "&PageNo=" + PageNo + "&SystemCode=" + SystemCode;
	eval(iFrame + ".location.href = '" + iPath + "\TCGGetRelated2.aspx?" + iList + "'");
}
function Search() {
	var Key = document.getElementById("TCGTop1_SearchKey").value.replace(/'/gi, "|^^|");
	Key = Key.replace(/"/gi, "|^^|");
	Key = Key.replace(/</gi, "|^^|");
	Key = Key.replace(/>/gi, "|^^|");
	Key = Key.replace(/-/gi, "|^^|");
	if (Key.length > 0) {
		//document.getElementById("SearchHistory").value = Key;
		document.getElementById("TCGTop1_SearchKey").value = "";
		//以圖決定目前是sort by 最新話題 OR 熱門話題
		if (document.images['imgCreateDate'].src.indexOf("con_n1") > 0) 
		{
			SearchList("0", "Key", Key, 0, "CreateDate DESC, Subject");
		}
		if (document.images['imgHot'].src.indexOf("con_h1") > 0) 
		{
			SearchList("0", "Key", Key, 0, "Hot DESC, Subject");
		}
		//SearchList("0", "Key", Key, 0, "Subject");
	}
}

function Research() {
	var Key = document.getElementById("TCGFAQ1_ResearchKey").value.replace(/'/gi, "|^^|");
	Key = Key.replace(/"/gi, "|^^|");
	Key = Key.replace(/</gi, "|^^|");
	Key = Key.replace(/>/gi, "|^^|");
	Key = Key.replace(/-/gi, "|^^|");
	//alert(Key);
	if (Key.length > 0) {
		if (document.getElementById("SearchHistory").value.length > 0) {
			Key = document.getElementById("SearchHistory").value + " and " + Key;
		}
		document.getElementById("SearchHistory").value = Key;
		document.getElementById("TCGFAQ1_ResearchKey").value = "";
		SearchList(iCategoryID, iCategoryType, Key, 0, iSortOrder);
	}
}

function SearchList(CategoryID, CategoryType, KeyList, PageNo, SortOrder) {
	//alert(KeyList);
	//document.getElementById("TCGFAQ1_Research").style.display = "";
	if ((iSortOrder.length > 0) && (SortOrder.length > 0)) {
		if (iSortOrder.indexOf(SortOrder) >= 0) {
			if (iSortOrder.toUpperCase().indexOf("DESC") > 0) {
				iSortOrder = SortOrder;
			}
			else {
				iSortOrder = SortOrder + " DESC";
			}
		}
		else {
			iSortOrder = SortOrder;
		}
	}
	if (iSortOrder.length == 0) {
		iSortOrder = SortOrder;
	}
	iCategoryID = CategoryID;
	iCategoryType = CategoryType;
	iList = "CategoryID=" + CategoryID + "&CategoryType=" + CategoryType + "&KeyList=" + escape(KeyList) + "&PageNo=" + PageNo + "&SortOrder=" + iSortOrder;
	//alert(iList)
	eval(iFrame2 + ".location = '" + iPath + "\TCGGetSearch.ASPX?" + iList + "';");
}

function SearchList2(CategoryID, CategoryType, KeyList, PageNo, SortOrder) {
	document.getElementById("TCGFAQ1_Research").style.display = "";
	if ((iSortOrder.length > 0) && (SortOrder.length > 0)) {
		if (iSortOrder.indexOf(SortOrder) >= 0) {
			if (iSortOrder.toUpperCase().indexOf("DESC") > 0) {
				iSortOrder = SortOrder;
			}
			else {
				iSortOrder = SortOrder + " DESC";
			}
		}
		else {
			iSortOrder = SortOrder;
		}
	}
	if (iSortOrder.length == 0) {
		iSortOrder = SortOrder;
	}
	iCategoryID = CategoryID;
	iCategoryType = CategoryType;
	iList = "CategoryID=" + CategoryID + "&CategoryType=" + CategoryType + "&KeyList=" + escape(KeyList) + "&PageNo=" + PageNo + "&SortOrder=" + iSortOrder + "&mail=1";
	eval(iFrame + ".location = '" + iPath + "\TCGGetSearch.ASPX?" + iList + "';");
}


function ShowArchives(ArchivesID) {
	iList = "\TCGGetFAQ.ASPX?ArchivesID=" + ArchivesID;
	//if (document.location.href.toUpperCase().indexOf("CLMG00000.ASPX")>0) {
		//top.location.href = iPath + "\TCGGetFAQ.ASPX?" + iList;	
	//}
	//else {
		//window.open(iPath + "\TCGGetFAQ.ASPX?" + iList, "Archives", "");
	//}
	var mWith = 600;
	var mHeight = 500;
	var wTop = (screen.height-mHeight)/2;
	var wLeft = (screen.width - mWith)/2;

	iList = iPath + '\TCGGetFAQ.ASPX?ArchivesID=' + ArchivesID;
	//window.open(iPath + "\TCGGetFAQ.ASPX?" + iList, "Archives", "width=600;height=1000;");
	//Edited By JEDI 20060918
	window.open(iList,'Archives','top=' + wTop + ',left=' + wLeft + ',scrollbars=yes,resizable=yes,status=no,width=' + mWith + ',height=' + mHeight);
	//top.location.href = iList;
}

function view_resume(x){
	var imgResume = document.getElementById(x.substring(0, x.indexOf("_")) + "_ImageView").src
	imgResume = imgResume.substring(0, imgResume.lastIndexOf("/"));
	if (document.getElementById(x).style.display == "") {
		document.getElementById(x).style.display = 'none';
		document.getElementById(x.substring(0, x.indexOf("_")) + "_ImageView").src = imgResume + "/tab_03.gif";
		document.getElementById(x.substring(0, x.indexOf("_")) + "_ImageView").alt = "開啟" + document.getElementById(x.substring(0, x.indexOf("_")) + "_ImageView").alt.substring(2,document.getElementById(x.substring(0, x.indexOf("_")) + "_ImageView").alt.length);
	}
	else{
	  document.getElementById(x).style.display = '';
	  document.getElementById(x.substring(0, x.indexOf("_")) + "_ImageView").src = imgResume + "/tab_04.gif";
	  document.getElementById(x.substring(0, x.indexOf("_")) + "_ImageView").alt = "關閉" + document.getElementById(x.substring(0, x.indexOf("_")) + "_ImageView").alt.substring(2,document.getElementById(x.substring(0, x.indexOf("_")) + "_ImageView").alt.length);
	}
}

function initAddr() {
	document.forms[0].cboAddr2.style.display = 'none';
	var newitem = document.createElement('OPTION');
	newitem.value = '請選擇';
	newitem.text = '請選擇';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '國外地';
	newitem.text = '國外地區';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '基隆市';
	newitem.text = '基隆市';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '台北市';
	newitem.text = '台北市';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '台北縣';
	newitem.text = '台北縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '桃園縣';
	newitem.text = '桃園縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '新竹市';
	newitem.text = '新竹市';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '新竹縣';
	newitem.text = '新竹縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '苗栗縣';
	newitem.text = '苗栗縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '台中市';
	newitem.text = '台中市';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '台中縣';
	newitem.text = '台中縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '彰化縣';
	newitem.text = '彰化縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '南投縣';
	newitem.text = '南投縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '雲林縣';
	newitem.text = '雲林縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '嘉義市';
	newitem.text = '嘉義市';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '嘉義縣';
	newitem.text = '嘉義縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '台南市';
	newitem.text = '台南市';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '台南縣';
	newitem.text = '台南縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '高雄市';
	newitem.text = '高雄市';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '高雄縣';
	newitem.text = '高雄縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '屏東縣';
	newitem.text = '屏東縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '台東縣';
	newitem.text = '台東縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '花蓮縣';
	newitem.text = '花蓮縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '宜蘭縣';
	newitem.text = '宜蘭縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '澎湖縣';
	newitem.text = '澎湖縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '金門縣';
	newitem.text = '金門縣';
	document.forms[0].cboAddr1.options.add(newitem);
	newitem = document.createElement('OPTION');
	newitem.value = '連江縣';
	newitem.text = '連江縣';
	document.forms[0].cboAddr1.options.add(newitem);
	document.forms[0].cboAddr1.selectedIndex = 0;
}

var city_account = 26;
var cityarea = new Array();
var cityarea_account = new Array();
cityarea_account[0] = 0;
cityarea_account[1] = 0;
cityarea_account[2] = 7;
cityarea_account[3] = 19;
cityarea_account[4] = 48;
cityarea_account[5] = 61;
cityarea_account[6] = 62;
cityarea_account[7] = 75;
cityarea_account[8] = 93;
cityarea_account[9] = 101;
cityarea_account[10] = 122;
cityarea_account[11] = 148;
cityarea_account[12] = 161;
cityarea_account[13] = 181;
cityarea_account[14] = 182;
cityarea_account[15] = 200;
cityarea_account[16] = 207;
cityarea_account[17] = 237;
cityarea_account[18] = 248;
cityarea_account[19] = 275;
cityarea_account[20] = 306;
cityarea_account[21] = 321;
cityarea_account[22] = 333;
cityarea_account[23] = 345;
cityarea_account[24] = 351;
cityarea_account[25] = 355;
cityarea_account[26] = 356;
cityarea[1] = '七堵區';
cityarea[2] = '中山區';
cityarea[3] = '中正區';
cityarea[4] = '仁愛區';
cityarea[5] = '安樂區';
cityarea[6] = '信義區';
cityarea[7] = '暖暖區';
cityarea[8] = '士林區';
cityarea[9] = '大同區';
cityarea[10] = '大安區';
cityarea[11] = '中山區';
cityarea[12] = '中正區';
cityarea[13] = '內湖區';
cityarea[14] = '文山區';
cityarea[15] = '北投區';
cityarea[16] = '松山區';
cityarea[17] = '信義區';
cityarea[18] = '南港區';
cityarea[19] = '萬華區';
cityarea[20] = '八里鄉';
cityarea[21] = '三芝鄉';
cityarea[22] = '三重市';
cityarea[23] = '三峽鎮';
cityarea[24] = '土城市';
cityarea[25] = '中和市';
cityarea[26] = '五股鄉';
cityarea[27] = '平溪鄉';
cityarea[28] = '永和市';
cityarea[29] = '石門鄉';
cityarea[30] = '石碇鄉';
cityarea[31] = '汐止市';
cityarea[32] = '坪林鄉';
cityarea[33] = '林口鄉';
cityarea[34] = '板橋市';
cityarea[35] = '金山鄉';
cityarea[36] = '泰山鄉';
cityarea[37] = '烏來鄉';
cityarea[38] = '貢寮鄉';
cityarea[39] = '淡水鎮';
cityarea[40] = '深坑鄉';
cityarea[41] = '新店市';
cityarea[42] = '新莊市';
cityarea[43] = '瑞芳鎮';
cityarea[44] = '萬里鄉';
cityarea[45] = '樹林市';
cityarea[46] = '雙溪鄉';
cityarea[47] = '蘆洲市';
cityarea[48] = '鶯歌鎮';
cityarea[49] = '八德市';
cityarea[50] = '大園鄉';
cityarea[51] = '大溪鎮';
cityarea[52] = '中壢市';
cityarea[53] = '平鎮市';
cityarea[54] = '桃園市';
cityarea[55] = '復興鄉';
cityarea[56] = '新屋鄉';
cityarea[57] = '楊梅鎮';
cityarea[58] = '龍潭鄉';
cityarea[59] = '龜山鄉';
cityarea[60] = '蘆竹鄉';
cityarea[61] = '觀音鄉';
cityarea[62] = '新竹市';
cityarea[63] = '五峰鄉';
cityarea[64] = '北埔鄉';
cityarea[65] = '尖石鄉';
cityarea[66] = '竹北市';
cityarea[67] = '竹東鎮';
cityarea[68] = '芎林鄉';
cityarea[69] = '峨眉鄉';
cityarea[70] = '湖口鄉';
cityarea[71] = '新埔鎮';
cityarea[72] = '新豐鄉';
cityarea[73] = '橫山鄉';
cityarea[74] = '關西鎮';
cityarea[75] = '寶山鄉';
cityarea[76] = '三義鄉';
cityarea[77] = '三灣鄉';
cityarea[78] = '大湖鄉';
cityarea[79] = '公館鄉';
cityarea[80] = '竹南鎮';
cityarea[81] = '西湖鄉';
cityarea[82] = '卓蘭鎮';
cityarea[83] = '南庄鄉';
cityarea[84] = '後龍鎮';
cityarea[85] = '苗栗市';
cityarea[86] = '苑裡鎮';
cityarea[87] = '泰安鄉';
cityarea[88] = '通霄鎮';
cityarea[89] = '造橋鄉';
cityarea[90] = '獅潭鄉';
cityarea[91] = '銅鑼鄉';
cityarea[92] = '頭份鎮';
cityarea[93] = '頭屋鄉';
cityarea[94] = '中區';
cityarea[95] = '北屯區';
cityarea[96] = '北區';
cityarea[97] = '西屯區';
cityarea[98] = '西區';
cityarea[99] = '南屯區';
cityarea[100] = '南區';
cityarea[101] = '東區';
cityarea[102] = '大甲鎮';
cityarea[103] = '大安鄉';
cityarea[104] = '大肚鄉';
cityarea[105] = '大里市';
cityarea[106] = '大雅鄉';
cityarea[107] = '太平市';
cityarea[108] = '外埔鄉';
cityarea[109] = '石岡鄉';
cityarea[110] = '后里鄉';
cityarea[111] = '沙鹿鎮';
cityarea[112] = '和平鄉';
cityarea[113] = '東勢鎮';
cityarea[114] = '烏日鄉';
cityarea[115] = '神岡鄉';
cityarea[116] = '梧棲鎮';
cityarea[117] = '清水鎮';
cityarea[118] = '新社鄉';
cityarea[119] = '潭子鄉';
cityarea[120] = '龍井鄉';
cityarea[121] = '豐原市';
cityarea[122] = '霧峰鄉';
cityarea[123] = '二水鄉';
cityarea[124] = '二林鎮';
cityarea[125] = '大村鄉';
cityarea[126] = '大城鄉';
cityarea[127] = '北斗鎮';
cityarea[128] = '永靖鄉';
cityarea[129] = '田中鎮';
cityarea[130] = '田尾鄉';
cityarea[131] = '竹塘鄉';
cityarea[132] = '伸港鄉';
cityarea[133] = '秀水鄉';
cityarea[134] = '鎮';
cityarea[135] = '社頭鄉';
cityarea[136] = '芳苑鄉';
cityarea[137] = '花壇鄉';
cityarea[138] = '芬園鄉';
cityarea[139] = '員林鎮';
cityarea[140] = '埔心鄉';
cityarea[141] = '埔鹽鄉';
cityarea[142] = '埤頭鄉';
cityarea[143] = '鹿港®';
cityarea[144] = '溪州鄉';
cityarea[145] = '溪湖鎮';
cityarea[146] = '彰化市';
cityarea[147] = '福興鄉';
cityarea[148] = '線西鄉';
cityarea[149] = '中寮鄉';
cityarea[150] = '仁愛鄉';
cityarea[151] = '水里鄉';
cityarea[152] = '名間鄉';
cityarea[153] = '竹山鎮';
cityarea[154] = '信義鄉';
cityarea[155] = 'W投市';
cityarea[156] = '埔里鎮';
cityarea[157] = '草屯鎮';
cityarea[158] = '國姓鄉';
cityarea[159] = '魚池鄉';
cityarea[160] = '鹿谷鄉';
cityarea[161] = '集集鎮';
cityarea[162] = '二崙鄉';
cityarea[163] = '口湖鄉';
cityarea[164] = '土庫鎮';
cityarea[165] = '大埤鄉';
cityarea[166] = '元長鄉';
cityarea[167] = '斗六市';
cityarea[168] = '南鎮';
cityarea[169] = '水林鄉';
cityarea[170] = '北港鎮';
cityarea[171] = '古坑鄉';
cityarea[172] = '台西鄉';
cityarea[173] = '四湖鄉';
cityarea[174] = '西螺鎮';
cityarea[175] = '東勢鄉';
cityarea[176] = '林內鄉';
cityarea[177] = '虎尾鎮';
cityarea[178] = '崙背鄉';
cityarea[179] = '麥寮鄉';
cityarea[180] = '莿桐鄉';
cityarea[181] = '褒忠鄉';
cityarea[182] = '嘉義市';
cityarea[183] = '大林鄉';
cityarea[184] = '大埔鄉';
cityarea[185] = '中埔鄉';
cityarea[186] = '六腳鄉';
cityarea[187] = '太保市';
cityarea[188] = '水上鄉';
cityarea[189] = '布袋鎮';
cityarea[190] = '民雄鄉';
cityarea[191] = '朴子市';
cityarea[192] = 'ù崎鄉';
cityarea[193] = '東石鄉';
cityarea[194] = '阿里山';
cityarea[195] = '梅山鄉';
cityarea[196] = '鹿草鄉';
cityarea[197] = 'j路鄉';
cityarea[198] = '新港鄉';
cityarea[199] = '溪口鄉';
cityarea[200] = '義竹鄉';
cityarea[201] = '中區';
cityarea[202] = '北區';
cityarea[203] = '安平區';
cityarea[204] = '安南區';
cityarea[205] = '西區';
cityarea[206] = '東區';
cityarea[207] = '南區';
cityarea[208] = '七股鄉';
cityarea[209] = '下營鄉';
cityarea[210] = '大內鄉';
cityarea[211] = '山上鄉';
cityarea[212] = '仁德鄉';
cityarea[213] = '六甲鄉';
cityarea[214] = '北門鄉';
cityarea[215] = '左鎮鄉';
cityarea[216] = '永康';
cityarea[217] = '玉井鄉';
cityarea[218] = '白河鎮';
cityarea[219] = '西港鄉';
cityarea[220] = '佳里鎮';
cityarea[221] = '官田鄉';
cityarea[222] = '東山鄉';
cityarea[223] = '南化鄉';
cityarea[224] = '後壁鄉';
cityarea[225] = '柳營鄉';
cityarea[226] = '將軍鄉';
cityarea[227] = '麻豆鎮';
cityarea[228] = '善化鎮';
cityarea[229] = '新化鎮';
cityarea[230] = '新市鄉';
cityarea[231] = '新營市';
cityarea[232] = '楠西鄉';
cityarea[233] = '學甲鎮';
cityarea[234] = '龍崎鄉';
cityarea[235] = '歸仁鄉';
cityarea[236] = '關廟鄉';
cityarea[237] = '鹽水鎮';
cityarea[238] = '三民區';
cityarea[239] = '小港區';
cityarea[240] = '左營區';
cityarea[241] = '前金區';
cityarea[242] = '前鎮區';
cityarea[243] = '苓雅區';
cityarea[244] = '新興區';
cityarea[245] = '楠梓區';
cityarea[246] = '鼓山區';
cityarea[247] = '旗津區';
cityarea[248] = '鹽埕區';
cityarea[249] = '三民鄉';
cityarea[250] = '大社鄉';
cityarea[251] = '大寮鄉';
cityarea[252] = '大樹鄉';
cityarea[253] = '仁武鄉';
cityarea[254] = '內門鄉';
cityarea[255] = '六龜鄉';
cityarea[256] = '永安鄉';
cityarea[257] = '田寮鄉';
cityarea[258] = '甲仙鄉';
cityarea[259] = '杉林鄉';
cityarea[260] = '岡山鎮';
cityarea[261] = '林園鄉';
cityarea[262] = '阿蓮	';
cityarea[263] = '美濃鎮';
cityarea[264] = '茄萣鄉';
cityarea[265] = '茂林鄉';
cityarea[266] = '桃源鄉';
cityarea[267] = '梓官鄉';
cityarea[268] = '鳥松鄉';
cityarea[269] = '湖內鄉';
cityarea[270] = '路竹鄉';
cityarea[271] = '旗山鎮';
cityarea[272] = '鳳山市';
cityarea[273] = '橋頭鄉';
cityarea[274] = '燕巢鄉';
cityarea[275] = '彌陀鄉';
cityarea[276] = '九如鄉';
cityarea[277] = '三地門鄉';
cityarea[278] = '內埔鄉';
cityarea[279] = '竹田鄉';
cityarea[280] = '牡丹鄉';
cityarea[281] = '車城鄉';
cityarea[282] = '里港鄉';
cityarea[283] = '佳冬鄉';
cityarea[284] = '來義鄉';
cityarea[285] = '枋山鄉';
cityarea[286] = '枋寮鄉';
cityarea[287] = '東港鎮';
cityarea[288] = '林邊鄉';
cityarea[289] = '長治鄉';
cityarea[290] = '南州鄉';
cityarea[291] = '屏東市';
cityarea[292] = '恆春鎮';
cityarea[293] = '春日鄉';
cityarea[294] = '崁頂鄉';
cityarea[295] = '泰武鄉';
cityarea[296] = '琉球鄉';
cityarea[297] = '高樹鄉';
cityarea[298] = '新埤鄉';
cityarea[299] = '新園鄉';
cityarea[300] = '萬丹鄉';
cityarea[301] = '萬巒鄉';
cityarea[302] = '瑪家鄉';
cityarea[303] = '潮州鎮';
cityarea[304] = '霧台鄉';
cityarea[305] = '麟洛鄉';
cityarea[306] = '鹽埔鄉';
cityarea[307] = '大武鄉';
cityarea[308] = '太麻里';
cityarea[309] = '台東市';
cityarea[310] = '成功鎮';
cityarea[311] = '池上鄉';
cityarea[312] = '卑南鄉';
cityarea[313] = '延平鄉';
cityarea[314] = '東河鄉';
cityarea[315] = '長濱鄉';
cityarea[316] = '海端鄉';
cityarea[317] = '鹿野鄉';
cityarea[318] = '達仁鄉';
cityarea[319] = '綠島鄉';
cityarea[320] = '關山鎮';
cityarea[321] = '蘭嶼鄉';
cityarea[322] = '玉里鎮';
cityarea[323] = '光復鄉';
cityarea[324] = '吉安鄉';
cityarea[325] = '秀林鄉';
cityarea[326] = 'S溪鄉';
cityarea[327] = '花蓮市';
cityarea[328] = '富里鄉';
cityarea[329] = '新城鄉';
cityarea[330] = '瑞穗鄉';
cityarea[331] = '壽豐鄉';
cityarea[332] = '鳳林鎮';
cityarea[333] = '豐濱鄉';
cityarea[334] = '三星鄉';
cityarea[335] = '大同鄉';
cityarea[336] = '五結鄉';
cityarea[337] = '冬山鄉';
cityarea[338] = '壯圍鄉';
cityarea[339] = '宜蘭市';
cityarea[340] = '南澳鄉';
cityarea[341] = '員山鄉';
cityarea[342] = '頭城鎮';
cityarea[343] = '礁溪鄉';
cityarea[344] = '羅東鎮';
cityarea[345] = '蘇澳鎮';
cityarea[346] = '七美鄉';
cityarea[347] = '白沙鄉';
cityarea[348] = '西嶼鄉';
cityarea[349] = '馬公市';
cityarea[350] = '望安鄉';
cityarea[351] = '湖西鄉';
cityarea[352] = '金沙鎮';
cityarea[353] = '金城鎮';
cityarea[354] = '金寧鄉';
cityarea[355] = '烈嶼鄉';
cityarea[356] = '南竿鄉';

function addrChange() {
	document.forms[0].hidAddr1.value = document.forms[0].cboAddr1[document.forms[0].cboAddr1.selectedIndex].value;
	var i = document.forms[0].cboAddr1.selectedIndex;
	if (i < 2) {
		document.forms[0].cboAddr2.style.display = 'none';
		if (i == 1) {
			document.forms[0].txtSenderAddr.focus();
		}
	}
	else {
		while (document.forms[0].cboAddr2.length>0) {
			document.forms[0].cboAddr2.options[0] = null; 
		} 
		document.forms[0].cboAddr2.style.display = 'inline';
		var intCount = cityarea_account[i] - cityarea_account[i-1];
		var index = cityarea_account[i-1] + 1;
		var newitem;
		for (var j=0;j<intCount;j++) {
				newitem = document.createElement('OPTION');
				newitem.value = cityarea[index + j];
				newitem.text = cityarea[index + j];
				document.forms[0].cboAddr2.options.add(newitem);
		}
		document.forms[0].hidAddr2.value = document.forms[0].cboAddr2[0].text;
	}
}

function setAddr2() {
	document.forms[0].hidAddr2.value = document.forms[0].cboAddr2[document.forms[0].cboAddr2.selectedIndex].text;
}

function CaseFlowExpand() {
	if (document.getElementById("CASE_FLOW").style.display=='') {
		document.getElementById("CASE_FLOW").style.display = 'none';
		document.getElementById("HyperLink1").innerText = '案件流程資訊(Process)'
	}
	else {
		document.getElementById("CASE_FLOW").style.display = '';
		document.getElementById("HyperLink1").innerText = '案件流程資訊(Process)'
	}
}
		
function CaseReplyExpand() {
	if (document.getElementById("CASE_REPLY").style.display=='') {
		document.getElementById("CASE_REPLY").style.display = 'none';
		document.getElementById("HyperLink2").innerText = '案件回覆紀錄(Reply Records)'
	}
	else {
		document.getElementById("CASE_REPLY").style.display = '';
		document.getElementById("HyperLink2").innerText = '案件回覆紀錄(Reply Records)'
	}
}

function Download(strUploadFolder, strCaseId, strFileName) {
	var objForm=document.createElement('FORM');
	objForm.name='FrmDataForLogin';
	objForm.method='post';
	var objElement;
	objElement=document.createElement('INPUT');
	objElement.setAttribute('TYPE','HIDDEN');
	objElement.setAttribute('name','UploadFolder');
	objElement.setAttribute('id','UploadFolder');
	objElement.setAttribute('style','');
	objElement.style.display='none';
	objElement.setAttribute('value',strUploadFolder);
	objForm.appendChild(objElement);
	objElement=document.createElement('INPUT');
	objElement.setAttribute('TYPE','HIDDEN');
	objElement.setAttribute('name','CaseId');
	objElement.setAttribute('id','CaseId');
	objElement.setAttribute('style','');
	objElement.style.display='none';
	objElement.setAttribute('value',strCaseId);
	objForm.appendChild(objElement);
	objElement=document.createElement('INPUT');
	objElement.setAttribute('TYPE','HIDDEN');
	objElement.setAttribute('name','FileName');
	objElement.setAttribute('id','FileName');
	objElement.setAttribute('style','');
	objElement.style.display='none';
	objElement.setAttribute('value',strFileName);
	objForm.appendChild(objElement);
	document.body.appendChild(objForm);
	objForm.action="./../../comm/aspx/download.aspx";
	window.open(objForm.action + encodeURI("?UploadFolder=" + strUploadFolder + "&CaseId=" + strCaseId + "&FileName=" + strFileName), "IFrameExec");
}

function GotoQueNo(intQueNo, intDiaChoiceSeqNo){
	if (intQueNo==0 || intQueNo<0) {
		return false;
	}
	if (document.forms[0].hidDiaSeqNo.value=='2') {
			document.forms[0].rdoChoiceNo_2$2[0].checked = true;
	}
	
	if (document.forms[0].hidDiaSeqNo.value=='1') {
		switch (intDiaChoiceSeqNo) {
			case 1:
			case 2:
			case 3:
			case 16:
			case 17:
			case 18:
				Show_2nd_Question('none');
				return false;
			default :
				Show_2nd_Question('');
				break;
		}
	}
	//*****9709研考會要求開放二次問卷********************************************
	if (document.forms[0].hidDiaSeqNo.value=='4') {
		switch (intDiaChoiceSeqNo) {
			//case 73:
			//case 74:
			case 75:	
				Show_Tel_Interview('');		//顯示是否願意接受電訪選項
				document.forms[0].rdoChoiceNo_4$6[0].checked = true;
				Show_Contact_Info('none');	//不顯示電訪資訊
				return false;
			case 76:	
				Show_Tel_Interview('');		//顯示是否願意接受電訪選項
				document.forms[0].rdoChoiceNo_4$6[0].checked = true;
				Show_Contact_Info('none');	//不顯示電訪資訊
				return false;
			//case 77:
			//case 78:
			case 79:
				Show_Tel_Interview('');		//顯示是否願意接受電訪選項
				Show_Contact_Info('none');		//顯示電訪資訊
				return false;			
			case 80:
				Show_Tel_Interview('');		//顯示是否願意接受電訪選項
				Show_Contact_Info('');	//顯示電訪資訊
				return false;								
			default :
				Show_Tel_Interview('none');	
				Show_Contact_Info('none');
			break;
		}			
	}
	//*****9709研考會要求開放二次問卷 END********************************************
}

function Show_2nd_Question(strDisplay) {
	var check = false;
	var objSpans = document.getElementsByTagName('SPAN');
	for (var i=0;i<objSpans.length;i++) {
		if ((objSpans[i].id.indexOf('TableNo_2')!=-1)||(objSpans[i].id.indexOf('TableNo_4')!=-1)) {
			objSpans[i].style.display = strDisplay;
		}
	}
	if (typeof(Conatct)=='object') {
		Contact.style.display = strDisplay;
	}
	if (document.forms[0].hidDiaSeqNo.value=='4') {
		Show_Tel_Interview('none');
		Show_Contact_Info('none');
	}	
}

//*****9709研考會要求開放二次問卷********************************************
function Show_Tel_Interview(strDisplay) {
	var check = false;
	var objSpans = document.getElementsByTagName('SPAN');
	for (var i=0;i<objSpans.length;i++) {
		if ((objSpans[i].id.indexOf('TableNewNo_6')!=-1)) {
			objSpans[i].style.display = strDisplay;
		}
	}

}
function Show_Contact_Info(strDisplay) {
	if (typeof(NewContact)=='object') {
		NewContact.style.display = strDisplay;
	}	
}
//*****9709研考會要求開放二次問卷********************************************

var blnFlag = false;

function checkInput() {
	try {
		if (document.forms[0].hidDiaSeqNo.value=='1') {
			if (document.forms[0].txtReason.value.length > 4000) {
				alert('不滿意原因補充說明限制為4,000個中文字！');
				return false;
			}
		}
		//*****9706研考會更改新問卷***************************************************************************************
		if (document.forms[0].hidDiaSeqNo.value=='3'){
			if (document.forms[0].txtReason.value.length > 4000) {
				alert('其他意見補充說明限制為4,000個中文字！');
				return false;
			}			
		}
		//*****9706研考會更改新問卷 END***********************************************************************************
		
		document.forms[0].hidXML.value = MakeXML();
		var check = false;
		if (blnFlag) {
			if (document.forms[0].hidDiaSeqNo.value=='1') {
				if ((document.forms[0].rdoChoiceNo_1$1[3].checked)||(document.forms[0].rdoChoiceNo_1$1[4].checked)) {
					for (var i=0;i<document.forms[0].rdoChoiceNo_1$2.length;i++) {
						if (document.forms[0].rdoChoiceNo_1$2[i].checked) {
							check = true;
						}
					}
					if (!check) {
						alert('請務必填寫第 2 個問題！');
						return false;
					}
				}
				else {
					check = false;
					for (var i=0;i<document.forms[0].rdoChoiceNo_1$1.length;i++) {
						if (document.forms[0].rdoChoiceNo_1$1[i].checked) {
							check = true;
						}
					}
					if (!check) {
						alert('請務必填寫第 1 個問題！');
						return false;
					}
				}
			}
			if (document.forms[0].hidDiaSeqNo.value=='2') {
				if ((document.forms[0].rdoChoiceNo_2$1[3].checked)||(document.forms[0].rdoChoiceNo_2$1[4].checked)) {
					if ((!document.forms[0].rdoChoiceNo_2$2[0].checked)&&(!document.forms[0].rdoChoiceNo_2$2[1].checked)) {
							alert('請務必填寫第 2 個問題！');
							return false;
					}
				}
				else {
					check = false;
					for (var i=0;i<document.forms[0].rdoChoiceNo_2$1.length;i++) {
						if (document.forms[0].rdoChoiceNo_2$1[i].checked) {
							check = true;
						}
					}
					if (!check) {
						alert('請務必填寫第 1 個問題！');
						return false;
					}	
				}
	    			if ((document.forms[0].hidDiaSeqNo.value=='2')&&(document.forms[0].rdoChoiceNo_2$2[1].checked)) {
	    				if ((document.forms[0].txtTel.value=='')||(document.forms[0].txtTime.value=='')) {
	    	    				alert('請務必填寫電話、受訪人及受訪時間!');
	    	    				return false;
					}
				}
			}
			//*****9706研考會更改新問卷***************************************************************************************
			if (document.forms[0].hidDiaSeqNo.value=='3') {
				check = false;
				for (var i=0;i<document.forms[0].rdoChoiceNo_3$1.length;i++) {
					if (document.forms[0].rdoChoiceNo_3$1[i].checked) {
						
						check = true;
					}					
				}
				if (!check) {
						alert('請務必填寫第 1 個問題！');
						return false;
					}
				check = false;	
				for (var i=0;i<document.forms[0].rdoChoiceNo_3$2.length;i++) {
					if (document.forms[0].rdoChoiceNo_3$2[i].checked) {
						check = true;
					}					
				}
				if (!check) {
						alert('請務必填寫第 2 個問題！');
						return false;
					}
				check = false;	
				for (var i=0;i<document.forms[0].rdoChoiceNo_3$3.length;i++) {
					if (document.forms[0].rdoChoiceNo_3$3[i].checked) {
						check = true;
					}					
				}
				if (!check) {
						alert('請務必填寫第 3 個問題！');
						return false;
					}
				check = false;	
				for (var i=0;i<document.forms[0].rdoChoiceNo_3$4.length;i++) {
					if (document.forms[0].rdoChoiceNo_3$4[i].checked) {
						check = true;
					}					
				}
				if (!check) {
						alert('請務必填寫第 4 個問題！');
						return false;
					}
				check = false;		
				for (var i=0;i<document.forms[0].rdoChoiceNo_3$5.length;i++) {
					if (document.forms[0].rdoChoiceNo_3$5[i].checked) {
						check = true;
					}					
				}
				if (!check) {
						alert('請務必填寫第 5 個問題！');
						return false;
					}														
			}
			//*****9706研考會更改新問卷END***************************************************************************************
			//*****9709研考會要求開放二次問卷***************************************************************************************
			if (document.forms[0].hidDiaSeqNo.value=='4') {
				check = false;
				for (var i=0;i<document.forms[0].rdoChoiceNo_4$1.length;i++) {
					if (document.forms[0].rdoChoiceNo_4$1[i].checked) {
						
						check = true;
					}					
				}
				if (!check) {
						alert('請務必填寫第 1 個問題！');
						return false;
					}
				check = false;	
				for (var i=0;i<document.forms[0].rdoChoiceNo_4$2.length;i++) {
					if (document.forms[0].rdoChoiceNo_4$2[i].checked) {
						check = true;
					}					
				}
				if (!check) {
						alert('請務必填寫第 2 個問題！');
						return false;
					}
				check = false;	
				for (var i=0;i<document.forms[0].rdoChoiceNo_4$3.length;i++) {
					if (document.forms[0].rdoChoiceNo_4$3[i].checked) {
						check = true;
					}					
				}
				if (!check) {
						alert('請務必填寫第 3 個問題！');
						return false;
					}
				check = false;	
				for (var i=0;i<document.forms[0].rdoChoiceNo_4$4.length;i++) {
					if (document.forms[0].rdoChoiceNo_4$4[i].checked) {
						check = true;
					}					
				}
				if (!check) {
						alert('請務必填寫第 4 個問題！');
						return false;
					}
				check = false;		
				for (var i=0;i<document.forms[0].rdoChoiceNo_4$5.length;i++) {
					if (document.forms[0].rdoChoiceNo_4$5[i].checked) {
						check = true;
					}					
				}
				if (!check) {
						alert('請務必填寫第 5 個問題！');
						return false;
					}
																							
			}
			//*****9706研考會要求開放二次問卷END***************************************************************************************
		}
		else {
			alert('您尚未填寫問卷!!');
			return false;
		}
		return true;
	}
	catch(e){
		//alert(e);
	}	
}

function MakeXML() {
	try {
		var arrAnswer;
		var strxDom = '<?xml version="1.0" encoding="UTF-8"?><answers>';
		var objTags = document.getElementsByTagName('INPUT');
		var satis = false;
		if (typeof(objTags)=='object') {
			for (var i=0;i<objTags.length;i++) {
				arrAnswer = null;
				switch (objTags[i].type) {
					case 'checkbox':
					if (objTags(i).checked) {
						blnFlag=true;
						arrAnswer = objTags[i].id.replace(/chkChoiceNo_/i,'').split('$');
						strxDom+= '<dia_seq_no>' + arrAnswer[0] + '</dia_seq_no>';
						strxDom+= '<dia_que_seq_no>' + arrAnswer[1] + '</dia_que_seq_no>';
						strxDom+= '<dia_choice_seq_no>' + arrAnswer[2] + '</dia_choice_seq_no>';
						strxDom += '<dia_ans_txt></dia_ans_txt>';
						strxDom+= '<grp_seq_no>' + document.forms[0].hidGrpSeqNo.value + '</grp_seq_no>';
						strxDom += '<email>' + document.forms[0].hidEMail.value+ '</email>';
						strxDom += '<case_id>' + document.forms[0].hidCaseId.value + '</case_id>';
						strxDom += '<ou_id>' + document.forms[0].hidOuId.value + '</ou_id>';
					}
					break;
					case 'radio':
					if (objTags[i].checked){
						blnFlag=true;
						arrAnswer = objTags[i].id.replace(/rdoChoiceNo_/i,'').split('$');
						if (!satis) {
							strxDom+= '<dia_seq_no>' + arrAnswer[0] + '</dia_seq_no>';
							strxDom+= '<dia_que_seq_no>' + arrAnswer[1] + '</dia_que_seq_no>';
							strxDom+= '<dia_choice_seq_no>' + arrAnswer[2] + '</dia_choice_seq_no>';
							if (document.forms[0].hidDiaSeqNo.value=='2' && arrAnswer[1]==4) {
								strxDom += '<dia_ans_txt><root><phone>' + document.forms[0].txtTel.value.replace('<', '&lt;').replace('>', '&gt;') + '</phone><dtime>' + document.forms[0].txtTime.value.replace('<', '&lt;').replace('>', '&gt;') + '</dtime><callee>' + document.forms[0].txtCallee.value.replace('<', '&lt;').replace('>', '&gt;') + '</callee></root></dia_ans_txt>';
							}
							else {
								//*****9706研考會更改新問卷
								//if (document.forms[0].hidDiaSeqNo.value=='1') {
								if ((document.forms[0].hidDiaSeqNo.value=='1')||(document.forms[0].hidDiaSeqNo.value=='3')) {
									document.forms[0].txtReason.value = document.forms[0].txtReason.value.replace(/\r\n|\r|\n/g, ' ');
									document.forms[0].txtReason.value = document.forms[0].txtReason.value.replace(/</gi, '');
									document.forms[0].txtReason.value = document.forms[0].txtReason.value.replace(/>/gi, '');
									document.forms[0].txtReason.value = document.forms[0].txtReason.value.replace(/-/gi, '');
									strxDom += '<dia_ans_txt>' + document.forms[0].txtReason.value + '</dia_ans_txt>';
								//*****9706研考會更改新問卷END
								}
								else {
									//*****9709研考會要求開放二次問卷 START
									if ((document.forms[0].hidDiaSeqNo.value=='4') && ((document.forms[0].rdoChoiceNo_4$14$75.checked) || (document.forms[0].rdoChoiceNo_4$14$76.checked)) && (document.forms[0].rdoChoiceNo_4$15$80.checked)){
										//strxDom += '<dia_ans_txt>&lt;root&gt;&lt;phone&gt;' + document.forms[0].txtTel.value.replace(/</gi, '').replace(/>/gi, '').replace(/-/gi, '~') + '&lt;/phone&gt;&lt;dtime&gt;' + document.forms[0].txtTime.value.replace(/</gi, '').replace(/>/gi, '').replace(/-/gi, '~')  + '&lt;/dtime&gt;&lt;callee&gt;' + document.forms[0].txtCallee.value.replace(/</gi, '').replace(/>/gi, '').replace(/-/gi, '')  + '&lt;/callee&gt;&lt;/root&gt;</dia_ans_txt>';
										strxDom += '<dia_ans_txt><root><phone>' + document.forms[0].txtTel.value.replace(/</gi, '').replace(/>/gi, '').replace(/-/gi, '~') + '</phone><dtime>' + document.forms[0].txtTime.value.replace(/</gi, '').replace(/>/gi, '').replace(/-/gi, '~')  + '</dtime><callee>' + document.forms[0].txtCallee.value.replace(/</gi, '').replace(/>/gi, '').replace(/-/gi, '')  + '</callee>';
										document.forms[0].txtReason.value = document.forms[0].txtReason.value.replace(/\r\n|\r|\n/g, ' ');
										document.forms[0].txtReason.value = document.forms[0].txtReason.value.replace(/</gi, '');
										document.forms[0].txtReason.value = document.forms[0].txtReason.value.replace(/>/gi, '');
										document.forms[0].txtReason.value = document.forms[0].txtReason.value.replace(/-/gi, '');
										strxDom += '<reason>' + document.forms[0].txtReason.value + '</reason></root></dia_ans_txt>';
									}
									else {
										strxDom += '<dia_ans_txt></dia_ans_txt>';
									}
									//*****9709研考會要求開放二次問卷 END									
								};
							}
							strxDom+= '<grp_seq_no>' + document.forms[0].hidGrpSeqNo.value + '</grp_seq_no>';
							strxDom += '<email>' + document.forms[0].hidEMail.value + '</email>';
							strxDom += '<case_id>' + document.forms[0].hidCaseId.value + '</case_id>';
							strxDom += '<ou_id>' + document.forms[0].hidOuId.value + '</ou_id>';
																	
							switch (arrAnswer[2]) {
								case '1':
								case '2':
								case '3':
								case '16':
								case '17':
								case '18':
									satis = true;
									break;
								default :
									satis = false;
								break;
							}
						}
					break;
				}
					default:
				}
			}
		}
		/*	
		objTags = document.getElementsByTagName("TEXTAREA");
		if (typeof(objTags)=='object') {
			for (i=0;i<objTags.length;i++) {
				arrAnswer = null;
				if (gTrim(objTags(i).value).length!=0) {
					blnFlag=true;
					arrAnswer = objTags(i).id.replace(/txtrChoiceNo_/i,'').split('$');
					strxDom+= '<dia_seq_no>' + arrAnswer[0] + '</dia_seq_no>';
					strxDom+= '<dia_que_seq_no>' + arrAnswer[1] + '</dia_que_seq_no>';
					strxDom+= '<dia_choice_seq_no>' + arrAnswer[2] + '</dia_choice_seq_no>';
					strxDom += '<dia_ans_txt>' + objTags(i).value + '</dia_ans_txt>';
					strxDom+= '<grp_seq_no>' + document.forms[0].hidGrpSeqNo.value + '</grp_seq_no>';
					strxDom += '<email>' + document.forms[0].hidEMail.value + '</email>';
					strxDom += '<case_id>' + document.forms[0].hidCaseId.value + '</case_id>';
					strxDom += '<ou_id>' + document.forms[0].hidOuId.value + '</ou_id>'; 
				}
			}
		}
		*/
		strxDom+= '</answers>';	
		return strxDom;
	}
		catch(e){
		//alert(e);
	}	
}

function ShowEmail() {
	if (document.getElementById("DropDownList2").value=="True") {
		document.getElementById("Panel1").style.display = "";
	}
	else {
		document.getElementById("Panel1").style.display = "none";
	}
}

function getDefaultValue() {
	var CAddr = document.forms[0].txtSenderAddr.value;
	var strCity, strCityArea;
	var intLen = 3;
	if (CAddr!='') {
		strCity = CAddr.substring(0, 3);
		document.forms[0].cboAddr1.value = strCity;
		document.forms[0].hidAddr1.value = strCity;
		if (document.forms[0].cboAddr1.selectedIndex!=-1) {
			addrChange()
			CAddr = CAddr.substring(3, CAddr.length)
			if (CAddr.indexOf('三地門鄉')>0)
				intLen = '三地門鄉'.length;
			else {
				if ((CAddr.indexOf('北區')>0)||(CAddr.indexOf('西區')>0)||(CAddr.indexOf('東區')>0)||(CAddr.indexOf('南區')>0)||(CAddr.indexOf('中區')>0)) {
					intLen = '北區'.length;
				}
			}
			strCityArea = CAddr.substr(0, intLen);
			document.forms[0].cboAddr2.value = strCityArea;
			document.forms[0].hidAddr2.value = strCityArea;
			if (document.forms[0].cboAddr2.selectedIndex!=-1) {
				CAddr = CAddr.substr(intLen, CAddr.length);
			}
			document.forms[0].txtSenderAddr.value = CAddr;
		}
	}
}

function DownloadTemp(strUploadFolder, strCaseId, strFileName) {
	var actionUrl = "./../../comm/aspx/download.aspx";
	//alert("./../../comm/aspx/download.aspx?UploadFolder=" + strUploadFolder + "&CaseId=" + strCaseId + "&FileName=" + strFileName);
	window.open(actionUrl + encodeURI("?UploadFolder=" + strUploadFolder + "&CaseId=" + strCaseId + "&FileName=" + strFileName), "IFrameExec");
}

function checker() {
	var check = false;
	var objTags = document.getElementsByTagName("INPUT");
	if (typeof(objTags)=='object') {
		for (i=0;i<objTags.length;i++) {
			if (objTags[i].type=="checkbox") {		
				if (objTags[i].checked) {
					check = true;
				} 
			}
		}
		for (i=0;i<objTags.length;i++) {
			if (objTags[i].type=="checkbox") {		
				if (check) {
					objTags[i].checked = false;
				} 
				else {
					objTags[i].checked = true;
				}
			}			
		}
	}
}

function addFavorite() {
	var fID = "";
	var tempID = "";
	var objTags = document.getElementsByTagName("INPUT");
	if (typeof(objTags)=='object') {
		for (i=0;i<objTags.length;i++) {
			if (objTags[i].type=="checkbox") {
				if (objTags[i].checked) {
					tempID = objTags[i].id.split("_")
					fID += tempID[tempID.length - 1] + ",";
				}
			}
		}
	}
	fID = fID.substring(0, fID.length - 1);
	var wTop = (screen.height / 2) - 160;
	var wLeft = (screen.width / 2) - 100;
	window.open(iPath + '\TCGAddFavorite.aspx?ID=' + fID, 'Favorite', 'top=' + wTop + ',left=' + wLeft + ',scrollbars=yes,resizable=no,status=no,width=200,height=320');
}

function removeFavorite(cID) {
	var fID = "";
	var tempID = "";
	var objTags = document.getElementsByTagName("INPUT");
	if (typeof(objTags)=='object') {
		for (i=0;i<objTags.length;i++) {
			if (objTags[i].type=="checkbox") {
				if (objTags[i].checked) {
					tempID = objTags[i].id.split("_")
					fID += tempID[tempID.length - 1] + ",";
				}
			}
		}
	}
	fID = fID.substring(0, fID.length - 1);
	if (confirm("確定要將FAQ從我的最愛中移除嗎？")) {
		eval(iFrame + ".location.href = '" + iPath + "\TCGRemoveFavorite.aspx?ID=" + fID + "&cID=" + cID + "'");
	}
}


