﻿// JavaScript Document
function chkdata(theForm){
   //檢查會員資料的正確性
   var temail = theForm.memail.value.replace(/^\s*|\s*$/g, '')
   var tnickname = theForm.mnickname.value.replace(/^\s*|\s*$/g, '')
   var tpsd = theForm.mpsd.value.replace(/^\s*|\s*$/g, '')
   var tname = theForm.mname.value.replace(/^\s*|\s*$/g, '')
   var ttel = theForm.mtel.value.replace(/^\s*|\s*$/g, '')
   var tmobile = theForm.mmobile.value.replace(/^\s*|\s*$/g, '')
   var taddress= theForm.mstreet.value.replace(/^\s*|\s*$/g, '')
   
   if (temail == "" || isEmail(temail) == false){
	   alert("請輸入正確的E-Mail");
	   theForm.memail.focus();
	   return;
   }
   
   if(tnickname == "" || tnickname.length > 20){
	  alert("請輸入20字以內的暱稱");
	  theForm.mnickname.focus();
	  return ;
   }  
   
   
   if(tpsd == "" || tpsd.length > 12){
	  alert("輸入12字以內的密碼");
	  theForm.mpsd.focus();
	  return ;
   }  

   if(tname == "" || tname.length > 20){
	  alert("請輸入20字以內的姓名");
	  theForm.mname.focus();
	  return;
   }  

   if(theForm.msex[0].checked == false && theForm.msex[1].checked == false){
	  alert("請選擇您的性別");
	  theForm.msex[0].focus();
	  return;   
   }  

   if(ttel == "" || ttel.length > 20){
	  alert("請輸入20字以內的電話");
	  theForm.mtel.focus();
	  return; 
   }  
   
   if(tmobile == "" || tmobile.length > 20){
	  alert("請輸入20字以內的手機號碼");
	  theForm.mmobile.focus();
	  return;   
   }  
   if(theForm.city.selectedIndex == 0){
	  alert("請選擇您所在的城市");
	  theForm.city.focus();
	  return;   
   }  
   if(theForm.state.selectedIndex == 0){
	  alert("請選擇您所在的縣市");
	  theForm.state.focus();
	  return;   
   }  
   
   if(taddress == ""){
	  alert("請輸入您的地址");
	  theForm.mstreet.focus();
	  return;   
   }  
   theForm.act.value = "int";
   theForm.submit();
	
}
