﻿function trim(instr){
  return instr.replace(/^[\s]*/gi,"").replace(/[\s]*$/gi,"");
}


function checkEnter(){
if (window.event.keyCode == 13){
document.getElementById("ibtnOK").focus();
}
}

function getByteLength(strIN){
//計算byte
  var i, cnt=0;
  for (i=0; i<strIN.length; i++){
    if (escape(strIN.charAt(i)).length >= 4) cnt+=2;
    else cnt++;
  }
  return cnt;
} 


function checksearchdate(rbl1,rbl2,txtyear1,txtyear2,txtmonth1,txtmonth2,txtday1,txtday2){
 var txt;
 if (document.getElementById(rbl1).checked==false&&document.getElementById(rbl2).checked==false){
	txt=document.getElementById(rbl1);
	alert('請選擇捐款查詢方式');
	txt.focus();       
	return false;
	}
	
	if (document.getElementById(rbl1).checked==true){
	  if (document.getElementById(txtyear1).value==""){
		txt=document.getElementById(txtyear1);
		alert('請輸入(起始)年');
		txt.focus();       
		return false;
	    }
	    
	     if (document.getElementById(txtmonth1).value==""){
		txt=document.getElementById(txtmonth1);
		alert('請輸入(起始)月');
		txt.focus();       
		return false;
	    }
	    
	      if (document.getElementById(txtday1).value==""){
		txt=document.getElementById(txtday1);
		alert('請輸入(起始)日');
		txt.focus();       
		return false;
	    }
	    
	    if (document.getElementById(txtyear2).value==""){
		txt=document.getElementById(txtyear2);
		alert('請輸入(至)年');
		txt.focus();       
		return false;
	    }
	    
	     if (document.getElementById(txtmonth2).value==""){
		txt=document.getElementById(txtmonth2);
		alert('請輸入(至)月');
		txt.focus();       
		return false;
	    }
	    
	      if (document.getElementById(txtday2).value==""){
		txt=document.getElementById(txtday2);
		alert('請輸入(至)日');
		txt.focus();       
		return false;
	    }
	}
		
}

function checkTrade(rbl1,rbl2,rbl3,rbl4,rbl5){
 var txt;
 if (document.getElementById(rbl1).checked==false&&document.getElementById(rbl2).checked==false&&document.getElementById(rbl3).checked==false&&document.getElementById(rbl4).checked==false&&document.getElementById(rbl5).checked==false){
	txt=document.getElementById(rbl1);
	alert('請選擇捐款方式');
	txt.focus();       
	return false;
	}		
}


function checkps(txtUSER_ID,id){
 var txt;
 if (document.getElementById(txtUSER_ID).value==''){
	    txt=document.getElementById(txtUSER_ID);
		alert('請輸入E-mail 帳號');
		txt.focus();       
		return false;
		}else{
		    var fobj=document.getElementById(txtUSER_ID).value;
            var check=/.+@.+\..+/;
            if (fobj.match(check) ==null ){
                txt=document.getElementById(txtUSER_ID);
                alert("請輸入正確的E-mail 帳號"); 
                txt.focus(); 
                txt.value="";
                return false;
              } 
	
	} 
	
	if (document.getElementById(id).value==''){
	txt=document.getElementById(id);
	alert('請輸入身分證字號');
	txt.focus();       
	return false;
	}		
}

function checklogin(txtUSER_ID,txtPASSWORD){
 var txt;
 if (document.getElementById(txtUSER_ID).value==''){
	    txt=document.getElementById(txtUSER_ID);
		alert('請輸入E-mail 帳號');
		txt.focus();       
		return false;
		}else{
		    var fobj=document.getElementById(txtUSER_ID).value;
            var check=/.+@.+\..+/;
            if (fobj.match(check) ==null ){
                txt=document.getElementById(txtUSER_ID);
                alert("請輸入正確的E-mail 帳號"); 
                txt.focus(); 
                txt.value="";
                return false;
              } 
	
	} 
	
	if (document.getElementById(txtPASSWORD).value==''){
	txt=document.getElementById(txtPASSWORD);
	alert('請輸入密碼');
	txt.focus();       
	return false;
	}		
}

function checkforget(txtname,txtIDENTITY,ddlyear,ddlMonth,ddlDay){
 var txt;
 
 if (trim(document.getElementById(txtname).value)==''){
	    txt=document.getElementById(txtname);
		alert('請輸入中文姓名');
		txt.focus();       
		return false;
	    }else{	    
	     if ((trim(document.getElementById(txtname).value).length*2)!=getByteLength(document.getElementById(txtname).value)){
	      txt=document.getElementById(txtname);
		  alert('請輸入正確中文姓名\n請勿輸入其他字元');
		  txt.focus();       
		  return false;
	     }
	    }
	    
 if (document.getElementById(txtIDENTITY).value==''){
	    txt=document.getElementById(txtIDENTITY);
		alert('請輸入身分證字號');
		txt.focus();       
		return false;
		}
		
			if (document.getElementById(ddlyear).value=='請選擇'){
	    txt=document.getElementById(ddlyear);
		alert('請選擇生日(年)');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(ddlMonth).value=='請選擇'){
	    txt=document.getElementById(ddlMonth);
		alert('請選擇生日(月)');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(ddlDay).value=='請選擇'){
	    txt=document.getElementById(ddlDay);
		alert('請選擇生日(日)');
		txt.focus();       
		return false;
		}		
			
}

function checktxt(txtUSER_ID,txtPASSWORD,txtPASSWORD_r,txtIDENTITY,rblNAONALITY_Y,rblNAONALITY_N,txtname,rblM,rblF,ddlyear,ddlMonth,ddlDay,txtTELEPHONE1_1,txtTELEPHONE1_2,txtTELEPHONE2_1,txtTELEPHONE2_2,txtCELLPHONE1,ddlCITY_COD,ddlAREA_COD,hidAREA_COD,txtADDRESS){
var txt;

   if (document.getElementById(txtUSER_ID).value==''){
	    txt=document.getElementById(txtUSER_ID);
		alert('請輸入E-mail 帳號');
		txt.focus();       
		return false;
		}else{
		    var fobj=document.getElementById(txtUSER_ID).value;
            var check=/.+@.+\..+/;
            if (fobj.match(check) ==null ){
                txt=document.getElementById(txtUSER_ID);
                alert("請輸入正確的E-mail 帳號"); 
                txt.focus(); 
                txt.value="";
                return false;
              } 
	
	} 
	
	if (document.getElementById(txtPASSWORD).value==''){
	txt=document.getElementById(txtPASSWORD);
	alert('請輸入密碼');
	txt.focus();       
	return false;
	}		
	
	if (document.getElementById(txtPASSWORD_r).value==''){
	    txt=document.getElementById(txtPASSWORD_r);
		alert('請輸入確認密碼');
		txt.focus();       
		return false;
		}
	
	if (document.getElementById(txtPASSWORD).value!=document.getElementById(txtPASSWORD_r).value){
	    txt=document.getElementById(txtPASSWORD);
		alert('密碼與確認密碼不符');
		txt.focus();       
		return false;
		}
		
	if (document.getElementById(txtIDENTITY).value==''){
	    txt=document.getElementById(txtIDENTITY);
		alert('請輸入身分證字號');
		txt.focus();       
		return false;
		}else{ 
		  
				if (gfcChkID(trim(document.getElementById(txtIDENTITY).value))==false&&document.getElementById(rblNAONALITY_Y).checked==true){
				txt=document.getElementById(txtIDENTITY);
				alert('帳號(身份證字號不正確)');
				txt.focus(); 
				return false;
				}
		}		
			

       if (document.getElementById(rblNAONALITY_Y).checked==false&&document.getElementById(rblNAONALITY_N).checked==false){
	    txt=document.getElementById(rblNAONALITY_Y);
		alert('請選擇您是台灣人士或外籍人士');
		txt.focus();       
		return false;
		}	
			
		if (trim(document.getElementById(txtname).value)==''){
	    txt=document.getElementById(txtname);
		alert('請輸入中文姓名');
		txt.focus();       
		return false;
	    }else{	    
	     if ((trim(document.getElementById(txtname).value).length*2)!=getByteLength(document.getElementById(txtname).value)){
	      txt=document.getElementById(txtname);
		  alert('請輸入正確中文姓名\n請勿輸入其他字元');
		  txt.focus();       
		  return false;
	     }
	    }
		
	/*if (document.getElementById(txtUSER_ID).value==''){
	    txt=document.getElementById(txtUSER_ID);
		alert('請輸入統一編號');
		txt.focus();       
		return false;
		}else{
		if (document.getElementById(txtUSER_ID).value.length!=8||isNaN(document.getElementById(txtUSER_ID).value)==true){
		txt=document.getElementById(txtUSER_ID);
		alert('請輸入正確的統一編號');
		txt.focus();
		return false;   
		}
		}*/	
	
	
		if (document.getElementById(rblM).checked==false&&document.getElementById(rblF).checked==false){
	    txt=document.getElementById(rblM);
		alert('請選擇性別');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(ddlyear).value=='請選擇'){
	    txt=document.getElementById(ddlyear);
		alert('請選擇生日(年)');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(ddlMonth).value=='請選擇'){
	    txt=document.getElementById(ddlMonth);
		alert('請選擇生日(月)');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(ddlDay).value=='請選擇'){
	    txt=document.getElementById(ddlDay);
		alert('請選擇生日(日)');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(txtTELEPHONE1_1).value==''){
	    txt=document.getElementById(txtTELEPHONE1_1);
		alert('請輸入聯絡電話(日) 區碼');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(txtTELEPHONE1_2).value==''){
	    txt=document.getElementById(txtTELEPHONE1_2);
		alert('請輸入聯絡電話(日)電話號碼');
		txt.focus();       
		return false;
		}
		
			if (document.getElementById(txtTELEPHONE2_1).value==''){
	    txt=document.getElementById(txtTELEPHONE2_1);
		alert('請輸入聯絡電話(夜) 區碼');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(txtTELEPHONE2_2).value==''){
	    txt=document.getElementById(txtTELEPHONE2_2);
		alert('請輸入聯絡電話(夜)電話號碼');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(txtCELLPHONE1).value==''){
	    txt=document.getElementById(txtCELLPHONE1);
		alert('請輸入手機號碼');
		txt.focus();       
		return false;
		}		
		
		if (document.getElementById(ddlCITY_COD).value=='請選擇'){
	    txt=document.getElementById(ddlCITY_COD);
		alert('請選擇居住地址(縣市)');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(hidAREA_COD).value=='請選擇'||document.getElementById(hidAREA_COD).value==''){
	    txt=document.getElementById(ddlAREA_COD);
		alert('請選擇居住地址(鄉鎮市區)');
		txt.focus();       
		return false;
		}								
			
		if (document.getElementById(txtADDRESS).value==''){
	    txt=document.getElementById(txtADDRESS);
		alert('請選擇居住地址(地址)');
		txt.focus();       
		return false;
		}
			

}

function checktxt_u(txtUSER_ID,txtPASSWORD_old,txtPASSWORD,txtPASSWORD_r,rblM,rblF,ddlyear,ddlMonth,ddlDay,txtTELEPHONE1_1,txtTELEPHONE1_2,txtTELEPHONE2_1,txtTELEPHONE2_2,txtCELLPHONE1,ddlCITY_COD,ddlAREA_COD,hidAREA_COD,txtADDRESS){
var txt;		
	 if (document.getElementById(txtUSER_ID).value==''){
	    txt=document.getElementById(txtUSER_ID);
		alert('請輸入E-mail 帳號');
		txt.focus();       
		return false;
		}else{
		    var fobj=document.getElementById(txtUSER_ID).value;
            var check=/.+@.+\..+/;
            if (fobj.match(check) ==null ){
                txt=document.getElementById(txtUSER_ID);
                alert("請輸入正確的E-mail 帳號"); 
                txt.focus(); 
                txt.value="";
                return false;
              } 
	
	} 
	
	
	if (document.getElementById(txtPASSWORD_old).value==''){
	txt=document.getElementById(txtPASSWORD_old);
	alert('請輸入網路會友密碼');
	txt.focus();       
	return false;
	}		
	
	if (document.getElementById(txtPASSWORD).value!=''||document.getElementById(txtPASSWORD_r).value!=''){
	   if (document.getElementById(txtPASSWORD).value==''){
	txt=document.getElementById(txtPASSWORD);
	alert('請輸入密碼');
	txt.focus();       
	return false;
	}		
	
	if (document.getElementById(txtPASSWORD_r).value==''){
	    txt=document.getElementById(txtPASSWORD_r);
		alert('請輸入確認密碼');
		txt.focus();       
		return false;
		}
	
	if (document.getElementById(txtPASSWORD).value!=document.getElementById(txtPASSWORD_r).value){
	    txt=document.getElementById(txtPASSWORD);
		alert('密碼與確認密碼不符');
		txt.focus();       
		return false;
		}
	}
	 
	
	
		if (document.getElementById(rblM).checked==false&&document.getElementById(rblF).checked==false){
	    txt=document.getElementById(rblM);
		alert('請選擇性別');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(ddlyear).value=='請選擇'){
	    txt=document.getElementById(ddlyear);
		alert('請選擇生日(年)');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(ddlMonth).value=='請選擇'){
	    txt=document.getElementById(ddlMonth);
		alert('請選擇生日(月)');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(ddlDay).value=='請選擇'){
	    txt=document.getElementById(ddlDay);
		alert('請選擇生日(日)');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(txtTELEPHONE1_1).value==''){
	    txt=document.getElementById(txtTELEPHONE1_1);
		alert('請輸入聯絡電話(日) 區碼');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(txtTELEPHONE1_2).value==''){
	    txt=document.getElementById(txtTELEPHONE1_2);
		alert('請輸入聯絡電話(日)電話號碼');
		txt.focus();       
		return false;
		}
		
			if (document.getElementById(txtTELEPHONE2_1).value==''){
	    txt=document.getElementById(txtTELEPHONE2_1);
		alert('請輸入聯絡電話(夜) 區碼');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(txtTELEPHONE2_2).value==''){
	    txt=document.getElementById(txtTELEPHONE2_2);
		alert('請輸入聯絡電話(夜)電話號碼');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(txtCELLPHONE1).value==''){
	    txt=document.getElementById(txtCELLPHONE1);
		alert('請輸入手機號碼');
		txt.focus();       
		return false;
		}		
		
		if (document.getElementById(ddlCITY_COD).value=='請選擇'){
	    txt=document.getElementById(ddlCITY_COD);
		alert('請選擇居住地址(縣市)');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(hidAREA_COD).value=='請選擇'||document.getElementById(hidAREA_COD).value==''){
	    txt=document.getElementById(ddlAREA_COD);
		alert('請選擇居住地址(鄉鎮市區)');
		txt.focus();       
		return false;
		}								
			
		if (document.getElementById(txtADDRESS).value==''){
	    txt=document.getElementById(txtADDRESS);
		alert('請選擇居住地址(地址)');
		txt.focus();       
		return false;
		}
}


function checkCart(txtmoney,txtname,rblM,rblF,txtUSER_ID,ddlyear,ddlMonth,ddlDay,txtTELEPHONE1,txtTELEPHONE2_1,txtTELEPHONE2_2,txtCELLPHONE1,ddlCITY_COD,ddlAREA_COD,hidAREA_COD,txtADDRESS,rblTITLE,rblOCCUPATION,rblscrip_y,rblscrip_n,rblscrip_y_man,rblscrip_y_co,txtscrip_id,txtscrip_y_NAME,rblscrip_y_m,rblscrip_y_f,txtscrip_y_ADDRESS){

var txt;
   	if (document.getElementById(txtmoney).value==''){
	txt=document.getElementById(txtmoney);
	alert('請輸入急難救濟金');
	txt.focus();       
	return false;
	}else{
	 if (isNaN(document.getElementById(txtmoney).value)==true){
	  txt=document.getElementById(txtmoney);
	  alert('急難救濟金請以阿拉伯數字輸入');
	  txt.focus();       
	  return false;
	 }
	 	if (document.getElementById(txtmoney).value=='0'){
	txt=document.getElementById(txtmoney);
	alert('急難救濟金必須大於0元以上');
	txt.focus();       
	return false;
	}
	}		
	
		if (document.getElementById(rblM).checked==false&&document.getElementById(rblF).checked==false){
	    txt=document.getElementById(rblM);
		alert('請選擇性別');
		txt.focus();       
		return false;
		}
  
   if (document.getElementById(ddlyear).value=='請選擇'){
	    txt=document.getElementById(ddlyear);
		alert('請選擇生日(年)');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(ddlMonth).value=='請選擇'){
	    txt=document.getElementById(ddlMonth);
		alert('請選擇生日(月)');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(ddlDay).value=='請選擇'){
	    txt=document.getElementById(ddlDay);
		alert('請選擇生日(日)');
		txt.focus();       
		return false;
		}
			
   if (document.getElementById(txtUSER_ID).value==''){
	    txt=document.getElementById(txtUSER_ID);
		alert('請輸入E-mail');
		txt.focus();       
		return false;
		}else{
		    var fobj=document.getElementById(txtUSER_ID).value;
            var check=/.+@.+\..+/;
            if (fobj.match(check) ==null ){
                txt=document.getElementById(txtUSER_ID);
                alert("請輸入正確的E-mail"); 
                txt.focus(); 
                txt.value="";
                return false;
              } 
	
	} 
				
		if (trim(document.getElementById(txtname).value)==''){
	    txt=document.getElementById(txtname);
		alert('請輸入中文姓名');
		txt.focus();       
		return false;
	    }
	    /*
	    else{	    
	     if ((trim(document.getElementById(txtname).value).length*2)!=getByteLength(document.getElementById(txtname).value)){
	      txt=document.getElementById(txtname);
		  alert('請輸入正確中文姓名\n請勿輸入其他字元');
		  txt.focus();       
		  return false;
	     }
	    }*/	
				
		
		
		if (document.getElementById(txtTELEPHONE1).value==''){
	    txt=document.getElementById(txtTELEPHONE1);
		alert('請輸入聯絡電話ㄧ');
		txt.focus();       
		return false;
		}
		/*
		if (document.getElementById(txtTELEPHONE1_2).value==''){
	    txt=document.getElementById(txtTELEPHONE1_2);
		alert('請輸入聯絡電話ㄧ(電話號碼)');
		txt.focus();       
		return false;
		}
		
			if (document.getElementById(txtTELEPHONE2_1).value==''){
	    txt=document.getElementById(txtTELEPHONE2_1);
		alert('請輸入聯絡電話(夜) 區碼');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(txtTELEPHONE2_2).value==''){
	    txt=document.getElementById(txtTELEPHONE2_2);
		alert('請輸入聯絡電話(夜)電話號碼');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(txtCELLPHONE1).value==''){
	    txt=document.getElementById(txtCELLPHONE1);
		alert('請輸入手機號碼');
		txt.focus();       
		return false;
		}		*/
		
		if (document.getElementById(ddlCITY_COD).value=='請選擇'){
	    txt=document.getElementById(ddlCITY_COD);
		alert('請選擇居住地址(縣市)');
		txt.focus();       
		return false;
		}
		
		if (document.getElementById(hidAREA_COD).value=='請選擇'||document.getElementById(hidAREA_COD).value==''){
	    txt=document.getElementById(ddlAREA_COD);
		alert('請選擇居住地址(鄉鎮市區)');
		txt.focus();       
		return false;
		}								
			
		if (document.getElementById(txtADDRESS).value==''){
	    txt=document.getElementById(txtADDRESS);
		alert('請選擇居住地址(地址)');
		txt.focus();       
		return false;
		}
		
		
		if (document.getElementById(rblscrip_y).checked==false&&document.getElementById(rblscrip_n).checked==false){
	    txt=document.getElementById(rblscrip_y);
		alert('請選擇需不需要開立收據');
		txt.focus();       
		return false;
		}
		
	if (document.getElementById(rblscrip_y).checked==true){	  
	//需要的話
	
	    if (document.getElementById(rblscrip_y_man).checked==false&&document.getElementById(rblscrip_y_co).checked==false){	    
	       txt=document.getElementById(rblscrip_y_man);
		   alert('請選擇開立收據同捐款人或另開立收據抬頭');
		   txt.focus();       
		   return false;
		  } 
		   
		   if (document.getElementById(rblscrip_y_co).checked==true){		   
		         //捐款人收據資料
				if (document.getElementById(txtscrip_y_NAME).value==''){
				txt=document.getElementById(txtscrip_y_NAME);
				alert('請輸入開立收據抬頭');
				txt.focus();       
				return false;
				}
				
				if (document.getElementById(txtscrip_id).value==""){
				txt=document.getElementById(txtscrip_id);
				alert('請輸入收據身分證字號或統一編號');
				txt.focus();       
				return false;
				}else{
				if (document.getElementById(txtscrip_id).value.length!=8&&gfcChkID(document.getElementById(txtscrip_id).value)==false){
					txt=document.getElementById(txtscrip_id);
					alert('請輸入正確的收據身分證字號或統一編號');
					txt.focus();
					return false;  
				}
				}		
				/*	if (document.getElementById(rblscrip_y_m).checked==false&&document.getElementById(rblscrip_y_f).checked==false){
				txt=document.getElementById(rblscrip_y_m);
				alert('請選擇捐款收據收件人性別');
				txt.focus();       
				return false;
				}*/
				
					if (document.getElementById(txtscrip_y_ADDRESS).value==''){
				txt=document.getElementById(txtscrip_y_ADDRESS);
				alert('請輸入捐款收據地址');
				txt.focus();       
				return false;
				}	  
		        
				   
		   }
		   	
		}

}

//檢查身份證
function gfcChkID(pID)
{
    //var tobjRtn = new Object();
    var tobjRtn = true;
    var ixI;
    var tAreaNo;
    var tSum;
    var tAreaCode;
    var tSecondID;         //身份證第二碼

    if (pID == "" || pID == null)
    {
        //tobjRtn.eErr = false;
        tobjRtn = false;
        return tobjRtn;
    }
    tobjRtn.eErr = true;
    pID = pID.toUpperCase(); 
    if (pID.length != 10)//確定身份證字號有10碼
    {   
        //tobjRtn.eErrDesc = gfcGetErrDesc('S010');
        tobjRtn = false;
        return tobjRtn;             
    }       
    tAreaCode = pID.substr(0,1);
    if (tAreaCode.valueOf() < "A" || tAreaCode.valueOf() > "Z")//確定首碼在A-Z之間
    {   
        //tobjRtn.eErrDesc = gfcGetErrDesc('S011');
        tobjRtn = false;
        return tobjRtn;
    }  
    if (isNaN(parseInt(pID.substring(1,10),10)) == true) //確定2-10碼是數字
    {   
        //tobjRtn.eErrDesc = gfcGetErrDesc('S012');
        tobjRtn = false;
        return tobjRtn;
    }   
    //身份證號碼第 2 碼必須為 1 或 2
    tSecondID = pID.substr(1,1);
    if (tSecondID != "1" && tSecondID != "2")
    {   
        //tobjRtn.eErrDesc = gfcGetErrDesc('S013');
        tobjRtn = false;
        return tobjRtn;
    }
    //取得首碼對應的區域碼，A ->10, B->11, ..H->17,I->34, J->18...
    tAreaNo = "ABCDEFGHJKLMNPQRSTUVXYWZIO".search(tAreaCode) + 10;
    pID = tAreaNo.toString(10) + pID.substring(1,10);   
   
    //  取得CheckSum的值
    //  核對身份證號碼是否正確
    //  A  = 身份證號碼區域碼第 1碼
    //  A0 = 身份證號碼區域碼第 2碼 * (10 - 1)
    //  A1 = 身份證號碼第 2碼 * (10 - 2)
    //  A2 = 身份證號碼第 3碼 * (10 - 3)
    //  A3 = 身份證號碼第 4碼 * (10 - 4)
    //  A4 = 身份證號碼第 5碼 * (10 - 5)
    //  A5 = 身份證號碼第 6碼 * (10 - 6)
    //  A6 = 身份證號碼第 7碼 * (10 - 7)
    //  A7 = 身份證號碼第 8碼 * (10 - 8)
    //  A8 = 身份證號碼第 9碼 * (10 - 9)
    //  CheckSum = A + A0 + A1 + A2 + ........ + A7 + A8

    tSum = parseInt(pID.substr(0,1),10) + parseInt(pID.substr(10,1),10);   

    for(ixI=1;ixI<=9;ixI++)
    {   
        tSum = tSum + parseInt(pID.substr(ixI,1),10)*(10-ixI);
    }  
	
    if ((tSum % 10) != 0)
    {
        //tobjRtn.eErrDesc = gfcGetErrDesc('S013');
        tobjRtn = false;
        return tobjRtn;
    }
    //tobjRtn.eErr = false;
    tobjRtn = true;
    return tobjRtn;
}

function testNu2m(){
//48~57是數字0~9
//40~57是數字0~9跟一些電話號碼符號
//35是#號
if ( !(window.event.keyCode>=35 && window.event.keyCode<=57 ))
      window.event.keyCode = 0;
}

function testNum(){
if ( !(window.event.keyCode>=48 && window.event.keyCode<=57 ))
      window.event.keyCode = 0;
}

function testNu3m(){
if ( (window.event.keyCode>=58 && window.event.keyCode<=64)||(window.event.keyCode>=33 && window.event.keyCode<=46))
      window.event.keyCode = 0;
      //alert("請勿輸入@#$%..等特殊符號");
      return false;
}

function no_ctrl_v(){
if ((window.event.keyCode==17))
 //alert("請勿使用複製");
 return false;
     //window.event.keyCode = 0;
}

