/*******************************************************************************************************************
* 函數名稱: CheckIP																						       *	
* 功能說明: 檢查 所輸入之IP是否符合格式																	   *
* 傳入參數: 1. sTextObj 為 TEXT 元件 的名稱 ； 型態為 字串	；如sTextName 為空白，則不做任何動作	  		       *
*			2. sMsgTxt 為 TEXT 欄位名稱     ； 型態為 字串	；如有錯誤，則將此變數之內容帶入訊息				   *   
* 傳 回 值:   True  OR  False 																                       *
* 更新日期:   2009/01/15	 																                       *
* 更新人員:   林靖燕																                           *
********************************************************************************************************************/

	function CheckIP(sTextobj,sMsgTxt){
		var sx = sTextobj.value ;
		var re = new RegExp("[^0-9\.]+","i");
		var check = 1;
		var result;

		if (sx != ""){
			result = re.exec(sx);
			if (result != null) { 
				alert ("『" + sMsgTxt + "』 " + "不可輸入數字以外的資料");
				sTextobj.value="";
				sTextobj.select();
				check = 0;
				return false;
			} 
			var ip = sx.split(".");
			if (ip.length != 4){
				alert ("『" + sMsgTxt + "』 " + "輸入錯誤");
				sTextobj.value="";
				sTextobj.select();
				check = 0;
				return false;
			}
			for (var i=0 ; i<4 ; i++){
				if (eval(ip[i]) > 255){
					alert ("『" + sMsgTxt + "』 " + "每個值不得大於255");
					sTextobj.value="";
					sTextobj.select();
					check = 0;
					return false;
				}
			}
		}
		if (check ==1){
			return true;
		}
	}

/*******************************************************************************************************************
* 函數名稱: CheckNumbChar																						   *	
* 功能說明: 檢查 所輸入之姓名是否輸入文字及數字以外之其它資料，如有，則將以訊息告知使用者並將游標移至此欄位		   *
* 傳入參數: 1. sTextObj 為 TEXT 元件 的名稱 ； 型態為 字串	；如sTextName 為空白，則不做任何動作	  		       *
*			2. sMsgTxt 為 TEXT 欄位名稱     ； 型態為 字串	；如有錯誤，則將此變數之內容帶入訊息				   *   
* 傳 回 值:   True  OR  False 																                       *
* 更新日期:   2007/05/10	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function CheckNumbChar(sTextObj,sMsgTxt){
	var sx = sTextObj.value ;
	var re = new RegExp("[\?\/\.\*\+\?\|\(\)\[!#$%^&';,<>\}\{\"\~`]+","i");
	var result;
	result = re.exec(sx);
	if (result != null) { 
		alert ("『" + sMsgTxt + "』 " +"不可輸入數字、中英文字母以外的資料");
		sTextObj.select();
		return false;
	} else {
		return true;
	}
}

/*******************************************************************************************************************
* 函數名稱: CheckStr																						       *	
* 功能說明: 檢查 所輸入之值是否為數值、英文字母及"/"															   *
* 傳入參數: 1. sTextObj 為 TEXT 元件 的名稱 ； 型態為 字串	；如sTextName 為空白，則不做任何動作	  		       *
*			2. sMsgTxt 為 TEXT 欄位名稱     ； 型態為 字串	；如有錯誤，則將此變數之內容帶入訊息				   *   
* 傳 回 值:   True  OR  False 																                       *
* 更新日期:   2007/05/10	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function CheckStr(sTextobj,sMsgTxt){
	var sx = sTextobj.value ;
	var re = new RegExp("[^a-zA-Z0-9\/\]+","i"); 
	var result;
	result = re.exec(sx);
	if (result != null) { 
		alert ("『" + sMsgTxt + "』 " + "不可輸入數字、英文字母以外的資料");
//		sTextobj.value="";
		sTextobj.select();
		return false;
	} else {
		return true;
	}
}

/*******************************************************************************************************************
* 函數名稱: CheckNumE																						       *	
* 功能說明: 檢查 所輸入之值是否為數值字串																		   *
* 傳入參數: 1. sTextObj 為 TEXT 元件 的名稱 ； 型態為 字串	；如sTextName 為空白，則不做任何動作	  		       *
*			2. sMsgTxt 為 TEXT 欄位名稱     ； 型態為 字串	；如有錯誤，則將此變數之內容帶入訊息				   *   
* 傳 回 值:   True  OR  False 																                       *
* 更新日期:   2007/05/10	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function CheckNumE(sTextobj,sMsgTxt){
	var sx = sTextobj.value ;
	var re = new RegExp("[^a-zA-Z0-9]+","i"); 
	var result;
	result = re.exec(sx);
	if (result != null) { 
		alert ("『" + sMsgTxt + "』 " + "不可輸入數字、英文字母以外的資料");
		sTextobj.value="";
		sTextobj.select();
		return false;
	} else {
		return true;
	}
}

/*******************************************************************************************************************
* 函數名稱: CheckNumEMax																						       *	
* 功能說明: 檢查 所輸入之值是否為大寫英文字母																		   *
* 傳入參數: 1. sTextObj 為 TEXT 元件 的名稱 ； 型態為 字串	；如sTextName 為空白，則不做任何動作	  		       *
*			2. sMsgTxt 為 TEXT 欄位名稱     ； 型態為 字串	；如有錯誤，則將此變數之內容帶入訊息				   *   
* 傳 回 值:   True  OR  False 																                       *
* 更新日期:   2007/10/23	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function CheckNumEMax(sTextobj,sMsgTxt){
	var sx = sTextobj.value ;
	var re = new RegExp("[^A-Z]+","i"); 
	var result;
	result = re.exec(sx);
	if (result != null) { 
		alert ("『" + sMsgTxt + "』 " + "不可輸入英文字母大寫以外的資料");
		sTextobj.value="";
		sTextobj.select();
		return false;
	} else {
		return true;
	}
}

/*******************************************************************************************************************
* 函數名稱: CheckNumb																						       *	
* 功能說明: 檢查 所輸入之值是否為數值字串																		   *
* 傳入參數: 1. sTextObj 為 TEXT 元件 的名稱 ； 型態為 字串	；如sTextName 為空白，則不做任何動作	  		       *
*			2. sMsgTxt 為 TEXT 欄位名稱     ； 型態為 字串	；如有錯誤，則將此變數之內容帶入訊息				   *   
* 傳 回 值:   True  OR  False 																                       *
* 更新日期:   2007/05/10	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function CheckNumb(sTextobj,sMsgTxt){
	var sx = sTextobj.value ;
	var re = new RegExp("[^0-9]+","i"); 
	var result;
	result = re.exec(sx);
	if (result != null) { 
		alert ("『" + sMsgTxt + "』 " + "不可輸入數字以外的資料");
		sTextobj.value="";
		sTextobj.select();
		return false;
	} else {
		return true;
	}
}

/*******************************************************************************************************************
* 函數名稱: CheckTel																						       *	
* 功能說明: 檢查 所輸入之電話號碼																	   *
* 傳入參數: 1. sTextObj 為 TEXT 元件 的名稱 ； 型態為 字串	；如sTextName 為空白，則不做任何動作	  		       *
*			2. sMsgTxt 為 TEXT 欄位名稱     ； 型態為 字串	；如有錯誤，則將此變數之內容帶入訊息				   *   
* 傳 回 值:   True  OR  False 																                       *
* 更新日期:   2007/05/10	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function CheckTel(sTextobj,sMsgTxt){
	var sx = sTextobj.value ;
	var re = new RegExp("[^0-9\-\#\+:]+","i"); 
	var result;
	result = re.exec(sx);
	if (result != null) { 
		alert ('『' + sMsgTxt + '』' + '含有不允許的符號');
		sTextobj.value="";
		sTextobj.select();
		return false;
	} else {
		return true;
	}
}

/*******************************************************************************************************************
* 函數名稱: CheckApplynum																						       *	
* 功能說明: 檢查 所輸入之電話號碼																	   *
* 傳入參數: 1. sTextObj 為 TEXT 元件 的名稱 ； 型態為 字串	；如sTextName 為空白，則不做任何動作	  		       *
*			2. sMsgTxt 為 TEXT 欄位名稱     ； 型態為 字串	；如有錯誤，則將此變數之內容帶入訊息				   *   
* 傳 回 值:   True  OR  False 																                       *
* 更新日期:   2007/05/10	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function CheckApplynum(sTextobj,sMsgTxt){
	var sx = sTextobj.value ;
	var re = new RegExp("[^0-9\-\]+","i"); 
	var result;
	result = re.exec(sx);
	if (result != null) { 
		alert ("『" + sMsgTxt + "』 " + "含有不允許的符號");
		sTextobj.value="";
		sTextobj.select();
		return false;
	} else {
		return true;
	}
}


/*******************************************************************************************************************
* 函數名稱: CheckUrl																						       *	
* 功能說明: 檢查 所輸入之網址是否為正碼輸入																	   *
* 傳入參數: 1. sTextObj 為 TEXT 元件 的名稱 ； 型態為 字串	；如sTextName 為空白，則不做任何動作	  		       *
*			2. sMsgTxt 為 TEXT 欄位名稱     ； 型態為 字串	；如有錯誤，則將此變數之內容帶入訊息				   *   
* 傳 回 值:   True  OR  False 																                       *
* 更新日期:   2009/05/22	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function CheckUrl(sTextobj,sMsgTxt){
	var sx = sTextobj.value ;
	var re = new RegExp("[^a-zA-Z0-9\:\/\.\]+","i"); 
	var result;
	result = re.exec(sx);
	if (result != null) { 
		alert ('『' + sMsgTxt + '』' + '含有不允許的字元');
		sTextobj.value="";
		sTextobj.select();
		return false;
	} else {
		return true;
	}
}

/*******************************************************************************************************************
* 函數名稱: CheckTime																						       *	
* 功能說明: 檢查 輸入之時間是否正確																	   *
* 傳入參數: 1. sObj 為 TEXT 元件 的名稱 ； 型態為 字串	；如sTextName 為空白，則不做任何動作	  		       *
* 傳 回 值:   True  OR  False 																                       *
* 更新日期:   2007/08/21	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/
function CheckTime(sObj){
	if (sObj.value!="")
	 {
		var vStr = sObj.value;
		if(isNaN(vStr.substring(0,2))){
			alert("開始時間的前兩碼要輸入數值型態");
			sObj.focus();
			return false ;
		}
		if(vStr.substring(2,3) !=":"){
			alert("開始時間的中間要輸入':'");
			sObj.focus();
			return false ;
		}
		if(vStr.substring(2,3) =="："){
			alert("『:』需要輸入半型");
			sObj.focus();
			return false ;
		}

		if(vStr.substring(3)==""){
			alert("請輸入開始時間的後兩碼");
			sObj.focus();
			return false ;
		}
		else
		{
			if(vStr.substring(4)==""){
				alert("請輸入開始時間的後一碼");
				sObj.focus();
				return false ;
			}
			if(isNaN(vStr.substring(3))){
				alert("開始時間的後兩碼要輸入數值型態");
				sObj.focus();
				return false ;
			}
		}
	 }		
}

/*******************************************************************************************************************
* 函數名稱: CheckTextNum																					       *	
* 功能說明: 檢查 金額欄是否為空白時，如是則傳回０，否，則不變													   *
* 傳入參數: 1. sTextObj 為 TEXT 元件 的名稱 														  		       *   
* 傳 回 值:   0 																                       *
* 更新日期:   2007/05/10	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/
function CheckTextNum(sTextobj){
	if (sTextobj.value =="")
	{
		sTextobj.value = "0";
		return true;
	}
}

/*******************************************************************************************************************
* 函數名稱: CheckTextZero																					       *	
* 功能說明: 檢查 欄位是否為空白or零時																			   *
* 傳入參數: 1. sTextObj 為 TEXT 元件 的名稱 														  		       *   
* 傳 回 值:   True  OR  False																                       *
* 更新日期:   2007/06/20	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/
function CheckTextZero(sTextobj,sMsgTxt){
	var sx = sTextobj.value ;
	
	if (sx == "" || sx == "0")
	{
		alert ("『" + sMsgTxt + "』 " + "不可輸入空白或者是零");
		sTextobj.value="";
		sTextobj.select();
		return false;
	} else {
		return true;
	}
}


/*******************************************************************************************************************
* 函數名稱: MM_openBrWindow																						　 *	
* 功能說明: 開始新視窗 																							   *
* 傳入參數:																							  		       *
*																												   *   
* 傳 回 值:					 																                       *
* 更新日期:   2007/05/10	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/
	function MM_openBrWindow(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}

/*******************************************************************************************************************
* 函數名稱: CheckID																						       *	
* 功能說明: 檢查 所輸入之身份證字號是否正確																		   *
* 傳入參數: 1. sId 為 text 欄位值			； 型態為 字串	；如sTextName 為空白，則不做任何動作	  		       *
*							   *   
* 傳 回 值:   True  OR  False 																                       *
* 更新日期:   2007/05/10	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function CheckID(sId) {
  var sIdLoad = ''+ sId.value.toUpperCase()
  
  if (sIdLoad !="") {
	  if (sIdLoad.length != 10)
		{
			alert('身分證號碼錯誤!\r\n字數不足!')
			//sId.select();
			return false;
		}
	
	  //建立一個 ID_Input 陣列
	  var ID_Input    = new Array(10)
	  //將 sIdLoad 字串一個字元接著一個字元放入 ID_Input 陣列內
	  for (var i=0; i<10; i++) { ID_Input[i] = sIdLoad.charAt(i) }
	  //====以下測試 ID_Input[0] 是否為英文字母===
	  var EngString = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	  ID_Input[0]   = EngString.indexOf(ID_Input[0])
	  if (ID_Input[0] == -1)
		{
			alert('身分證號碼錯誤!\r\n無開頭的字母!')
			//sId.select();
			return false;
		}
	  if (ID_Input[1] !=1 && ID_Input[1] !=2)
		{
			alert('身分證號碼錯誤!\r\n無法辨識性別!')
			//sId.select();
			return false;
		}
		  var NumArray  = new Array(26)
		  NumArray[0]   = 1 ; NumArray[1]  = 10; NumArray[2]  = 19;
		  NumArray[3]   = 28; NumArray[4]  = 37; NumArray[5]  = 46;
		  NumArray[6]   = 55; NumArray[7]  = 64; NumArray[8]  = 39;
		  NumArray[9]   = 73; NumArray[10] = 82; NumArray[11] = 2 ;
		  NumArray[12]  = 11; NumArray[13] = 20; NumArray[14] = 48;
		  NumArray[15]  = 29; NumArray[16] = 38; NumArray[17] = 47;
		  NumArray[18]  = 56; NumArray[19] = 65; NumArray[20] = 74;
		  NumArray[21]  = 83; NumArray[22] = 21; NumArray[23] = 3 ;
		  NumArray[24]  = 12; NumArray[25] = 30;

	  var result = NumArray[ID_Input[0]]
	  for (var i=1; i<10; i++)
		{
		var NumString = '0123456789'
		ID_Input[i] = NumString.indexOf(ID_Input[i])
		if (ID_Input[i] == -1)
		  {
			  alert('身分證號碼錯誤!\r\n數字檢查錯誤!')
			  //sId.select();
			  return false;
		  }
		else
		  { result += ID_Input[i] * (9-i) }
		}
	
	  result += 1 * ID_Input[9]
	  if (result % 10 != 0)
		{
			alert('身分證號碼錯誤!\r\n加總檢查錯誤!')
			//sId.select();
			return false;
		}
	  return true;
 	} 
 }

/*******************************************************************************************************************
* 函數名稱: CheckEmail																						       *	
* 功能說明: 檢查 email格式是否正確																		       *
* 傳入參數: 1. sTextObj 為 text 欄位值； 型態為 字串	；如sTextName 為空白，則不做任何動作	  				   *
* 傳 回 值:   True or False																							   * 更新日期:   2007/05/10	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function CheckEmail(sTextObj){
	var x =	sTextObj.value ;
	var re = new RegExp("[\?\/\*\+\?\(\)\[!#$^&;',<>\}\{\"\~]+","i");
	var result;

	result = re.exec(x);

if (sTextObj.value!='') {
	
	if (result != null) { 

		alert ("你所輸入的E-Mail格式錯誤");

		sTextObj.select();

		return false;

	} else if (sTextObj.value.indexOf("@")<=0) {
		alert ("你所輸入的E-Mail格式錯誤");
		sTextObj.select();

		return false;
		
	} else if (parseInt(sTextObj.value.length)  == parseInt(sTextObj.value.lastIndexOf("@")+1) ) {
		alert ("你所輸入的E-Mail格式錯誤");
		sTextObj.select();

		return false;
		
	} else if (sTextObj.value.indexOf("@") != sTextObj.value.lastIndexOf("@")) {
		alert ("你所輸入的E-Mail格式錯誤");
		sTextObj.select();

		return false;
	} else if (sTextObj.value.indexOf(".",parseInt(sTextObj.value.indexOf("@"))) <= 0) {
		alert ("你所輸入的E-Mail格式錯誤");
		sTextObj.select();

		return false;
	} else if (parseInt(sTextObj.value.length)  == parseInt(sTextObj.value.lastIndexOf(".")+1) ) {
		alert ("你所輸入的E-Mail格式錯誤");
		sTextObj.select();

		return false;
	} else {
	
		return true;
	}

		return true;
  }
	
}
/*******************************************************************************************************************
* 函數名稱: CheckDate																						       *	
* 功能說明: 檢查 日期格式是否正常																		           *
* 傳入參數: 1. oObjName 為 text 名稱		 ； 型態為 字串	；如sTextName 為空白，則不做任何動作				   *
*			2.	sMsgTxt 為 TEXT 欄位名稱     ； 型態為 字串	；如有錯誤，則將此變數之內容帶入訊息				   *   
* 傳 回 值:   True or False																						   *
* 更新日期:   2007/05/10	 																				       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/
function CheckDate(oObjName,sMsgText){
	var lIs_ok;
	lIs_ok = true;   
	
	if (oObjName.value != "") { 
		
		sArry_date = oObjName.value.split("/") ;
		
		if (lIs_ok == true && sArry_date.length != 3) { 
			lIs_ok = false ;
			alert("對不起，你所輸入的『" + sMsgText + "』格式不正確");		
		} else {		
			sTemp_year = sArry_date[0] ;
			sTemp_month = sArry_date[1] ;
			sTemp_day = sArry_date[2] ;
		}
		
		//檢查是否輸入非數字的資料或數字格式不正確
		if (lIs_ok == true && (isNaN(sTemp_year) == true || sTemp_year.length != 4 || sTemp_year.indexOf(".",0) != -1 ) ) { 
			lIs_ok = false ;
			alert("對不起，你所輸入的『" + sMsgText + "』，年份格式不正確");		
		}
		
		
		if (lIs_ok == true && (isNaN(sTemp_month) == true || sTemp_month.indexOf(".",0) != -1 || (parseFloat(sTemp_month) < 1 || parseFloat(sTemp_month) > 12) ) ) { 
			lIs_ok = false ;
			alert("對不起，你所輸入的『" + sMsgText + "』，月份格式不正確");		
		}	
		
		if (lIs_ok == true) {
			
			switch (parseFloat(sTemp_month)) {
				
				case 1:
				case 3:
				case 5:
				case 7:
				case 8:
				case 10:
				case 12 :
					
					//alert(parseFloat(sTemp_day));
					if (lIs_ok == true && (isNaN(sTemp_day) == true || sTemp_day.indexOf(".",0) != -1 || (parseFloat(sTemp_day) < 1 || parseFloat(sTemp_day) > 31) ) ) { 
						lIs_ok = false ;
						alert("對不起，你所輸入的『" + sMsgText + "』，天數格式不正確");		
					}
					
					break;
				
				case 4:
				case 6:
				case 9:
				case 11 :
					if (lIs_ok == true && (isNaN(sTemp_day) == true || sTemp_day.indexOf(".",0) != -1 || (parseFloat(sTemp_day) < 1 || parseFloat(sTemp_day) > 30) ) ) { 
						lIs_ok = false ;
						alert("對不起，你所輸入的『" + sMsgText + "』，天數格式不正確");		
					}
					
					break;
				
				case 2 :
					
					if (parseFloat(sTemp_year) % 4 == 0 && parseFloat(sTemp_year) % 100 != 0 || parseFloat(sTemp_year) % 400 == 0) {
						
						if (lIs_ok == true && (isNaN(sTemp_day) == true || (parseFloat(sTemp_day) < 1 || parseFloat(sTemp_day) > 29) ) ) { 
							lIs_ok = false ;
							alert("對不起，你所輸入的『" + sMsgText + "』，天數格式不正確");		
						}
						
						break;
						
					} else {
						
						if (lIs_ok == true && (isNaN(sTemp_day) == true || (parseFloat(sTemp_day) < 1 || parseFloat(sTemp_day) > 28) ) ) { 
							lIs_ok = false ;
							alert("對不起，你所輸入的『" + sMsgText + "』，天數格式不正確");		
						}
						
						break;
					
					}
			}
		}		
	}

	if (lIs_ok == true) { 
		if (oObjName.value!= "") {
			if (sTemp_month.length<2)
			{
				sTemp_month = "0" + sTemp_month;
			}
			if (sTemp_day.length <2)
			{
				sTemp_day = "0" + sTemp_day;
			}

			oObjName.value=sTemp_year + "/" + sTemp_month + "/" + sTemp_day;
			return true;
		}
	} else {
		oObjName.value = "";
		oObjName.focus();
		return false;
	}	
}

/*******************************************************************************************************************
* 函數名稱: ToRight_All																						       *	
* 功能說明: 將多重欄位的資料全部從左邊移轉到右邊																   *
* 傳入參數: 1. sSource 為 左邊多重欄位值(來源資料)； 型態為 字串												   *   
*           2. sTarget  為 被移轉到的資料(目的資料)； 型態為 字串												   *
* 傳 回 值:   左邊的資料全部移轉到右邊 														                       *
* 更新日期:   2005/4/13	 																                           *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function ToRight_All(sSource,sTarget){
	var nNum;//照順序排序用
	var nTot;//判斷來源資料共有幾個

	nTot=sSource.length;
	nNum=0;
	for(i=0;i<nTot;i++){
		if(i-nNum>=0){
			oNewOption=document.createElement("OPTION");
			oNewOption.text=sSource.options[i-nNum].text;
			oNewOption.value=sSource.options[i-nNum].value;					
			AddItem(sTarget,oNewOption);
			DeleteItem(sSource,i-nNum);
			nNum=nNum+1;
		}
	}
}

/*******************************************************************************************************************
* 函數名稱: ToLeft_All																						       *	
* 功能說明: 將多重欄位的資料全部從右邊移轉到左邊																		   *
* 傳入參數: 1. sSource 為 右邊多重欄位值(來源資料)； 型態為 字串												   *   
*           2. sTarget  為 被移轉到的資料(目的資料)； 型態為 字串
* 傳 回 值:   右邊的資料全部移轉到左邊 																                       *
* 更新日期:   2005/4/13	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function ToLeft_All(sSource,sTarget){
	var nNum;//照順序排序用
	var nTot;//照順序排序用
	nTot=sSource.length;
	nNum=0;
	for(i=0;i<nTot;i++){
		if(i-nNum>=0){
			oNewOption=document.createElement("OPTION");
			oNewOption.text=sSource.options[i-nNum].text;
			oNewOption.value=sSource.options[i-nNum].value;					
			AddItem(sTarget,oNewOption);
			DeleteItem(sSource,i-nNum);
			nNum=nNum+1;
		}
	}
}

/*******************************************************************************************************************
* 函數名稱: ToRight																						           *	
* 功能說明: 將多重欄位的資料上邊所選取的資料移轉到下邊															   *
* 傳入參數: 1. sSource  為 下邊多重欄位值(來源資料)； 型態為 字串												   *   
*           2. sTarget  為 被移轉到的資料(目的資料)； 型態為 字串												   *
*			3. nCount   為上課類別為固定or自排(1為固定，2為自排)												   *
*			4. nClassCount   為上課總堂數																		   *
* 傳 回 值:   上邊所選取的資料全部移轉到下邊 																       *
* 更新日期:   2009/01/15	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function ToRight(sSource,sTarget){
	var nNum;//照順序排序用
	var nTot;//判斷來源資料共有幾個

	nTot=sSource.length;
	nNum=0;
	for(i=0;i<nTot;i++){
		if(i-nNum>=0){
			if (sSource.options[i-nNum].selected){
				oNewOption=document.createElement("OPTION");
				oNewOption.text=sSource.options[i-nNum].text;
				oNewOption.value=sSource.options[i-nNum].value;					
				AddItem(sTarget,oNewOption);
				DeleteItem(sSource,i-nNum);
				nNum=nNum+1;
			}
		}
	}
}

/*******************************************************************************************************************
* 函數名稱: ToLeft																						           *	
* 功能說明: 將多重欄位的資料下邊所選取的資料移轉到上邊															   *
* 傳入參數: 1. sSource  為 上邊多重欄位值(來源資料)； 型態為 字串												   *   
*           2. sTarget  為 被移轉到的資料(目的資料)； 型態為 字串												   *
*			3. nCount   為上課類別為固定or自排(1為固定，2為自排)												   *
*			4. nClassCount   為上課總堂數																		   *
* 傳 回 值:   下邊所選取的資料全部移轉到上邊 																       *
* 更新日期:   2009/01/15	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function ToLeft(sSource,sTarget){
	var nNum;//照順序排序用
	var nTot;//照順序排序用
	nTot=sSource.length;
	nNum=0;
	for(i=0;i<nTot;i++){
		if(i-nNum>=0){
			if (sSource.options[i-nNum].selected){
				oNewOption=document.createElement("OPTION");
				oNewOption.text=sSource.options[i-nNum].text;
				oNewOption.value=sSource.options[i-nNum].value;					
				AddItem(sTarget,oNewOption);
				DeleteItem(sSource,i-nNum);
				nNum=nNum+1;
			}
		}
	}
}

/*******************************************************************************************************************
* 函數名稱: AddItem																								   *	
* 功能說明: 新增項目資料到目的地的多重欄位																		   *
* 傳入參數: 1. nTheList 為 要新增的物件數值； 型態為 數值														   *   
*           2. nOpt  為 要新增的第幾個項目資料																	   *	
* 傳 回 值:   將值傳回到目的地多重欄位																               *
* 更新日期:   2009/01/15	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function AddItem(nTheList,nOpt) {
	nTheList.options.add(nOpt);
}

/*******************************************************************************************************************
* 函數名稱: DeleteItem																						       *	
* 功能說明: 將來源的多重欄位值做刪除動作																		   *
* 傳入參數: 1. nTheList 為 要刪除的物件項目值； 型態為 數值														   *   
*           2. nItemNo  為 要刪除的第幾個項目資料																   *
* 傳 回 值:   無																								   *
* 更新日期:   2009/01/15	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function DeleteItem(nTheList,nItemNo) {       
	 nTheList.options.remove(nItemNo);
}

/*******************************************************************************************************************
* 函數名稱: locke_table_view																				       *	
* 功能說明: 移動點選時改變顏色																					   *
* 傳入參數:																										   *   
* 傳 回 值:									 																       *
* 開發部門:   資訊發展中心　																	                       *
* 更新日期:   2008/8/11	 																                       *
* 更新人員:   林靖燕																	                           *
********************************************************************************************************************/

function locke_table_view( func_obj , func_color , func_over , func_down , func_type ){
//滑鼠事件的變色函數  locke_table_view( 指定物件, 表格顏色 , 滑鼠在上的顏色 , 滑鼠按下後顏色 , 類別{在上:over , 按下:down , 移出:out} )
	if ( !func_obj['be_check'] ){func_obj['be_check'] = 0;}
	//be_check用來檢查有無按下滑鼠用的。
	if ( !func_obj['style'] ){
			document.write('func_obj.id');
			return;
		}	
	if ( !func_obj.be_check ){
		//當未按下時
		if ( func_type == 'down' ){
				func_obj.style.backgroundColor=func_down;
				func_obj.be_check=1;
			}
		if ( func_type =='over' ){
				func_obj.style.backgroundColor=func_over;
			}
		if ( func_type == 'out' ){
				func_obj.style.backgroundColor=func_color;
			}
	}else{
		//已有按下後
		if ( func_type == 'down' ){
			func_obj.style.backgroundColor=func_color;
			func_obj.be_check=0;
		}
	}
}