//v1.0
function chkNoChar(txt,targetName){
	for(i=0;i<txt.length;i++){
	c = txt.charAt(i);
	if("!@#$%^/\"\'&*()+|".indexOf(c,0)>0){	alert("您在「"+targetName+"」輸入了不被接受的符號！");	return false;	}		
	}
}
function chkEmail(txt){
	data = txt.match(/^\S+@\S+\.\S+$/)
	if (!data || !txt) return false;
	return true;
}
function jsLtrim(txt){
	while (txt.indexOf(" ") == 0 ){	txt = txt.replace(" ","");	}
	return txt;
}

function jsRtrim(txt){
	while (txt.charAt(txt.length-1) == " " ){	txt = txt.substr(0,txt.length-1);	}
	return txt;
}
function chkNum(getkeyCode){
	c = getkeyCode;
	if((c>=35&&c<=45)||(c>=48&&c<=57)||(c>=96&&c<=105)||c==8||c==9||c==13||c==46||c==229) return true; return false;
}


function form_check(){
//check name
	mytxt = document.form1.name.value;
	mytxt = jsLtrim(mytxt);mytxt = jsRtrim(mytxt);
	if(mytxt.length < 2){
	alert("「姓名」不得少於 2 個字元");return false;
	}

//check year
	mytxt = document.form1.year.value;
	mytxt = jsLtrim(mytxt);mytxt = jsRtrim(mytxt);
	if(mytxt.length < 2){
	//alert("請在「出生年」輸入您的出生年!");return false;
	}
//check tel
	mytxt = document.form1.tel.value;
	mytxt = jsLtrim(mytxt);mytxt = jsRtrim(mytxt);
	if(mytxt.length < 8){
	alert("您輸入的「電話號碼」過短...請再確認!!");return false;
	}
//check todate
	temp = document.form1.todate[0].checked|document.form1.todate[1].checked|document.form1.todate[2].checked|document.form1.todate[3].checked|document.form1.todate[4].checked|document.form1.todate[5].checked;
	if(temp == false){
	alert("請選擇「希望預約之時間」，點選星期一~星期六!");return false;
	};
//check toTime
	temp = document.form1.toTime[0].checked|document.form1.toTime[1].checked|document.form1.toTime[2].checked;
	if(temp == false){
	alert("請選擇「希望預約之診段」，點選早診、午診或晚診!");return false;
	};
	

//check q8
	temp = document.form1.q8[0].checked|document.form1.q8[1].checked|document.form1.q8[2].checked|document.form1.q8[3].checked;
	if(temp == false){
	alert("請選擇「曾有下顎關節異常現象」尚未勾選！");return false;
	};
	

//check q9
	temp = document.form1.q9[0].checked|document.form1.q9[1].checked|document.form1.q9[2].checked|document.form1.q9[3].checked|document.form1.q9[4].checked;
	if(temp == false){
	alert("「目前假牙有異常狀況」尚未勾選！");return false;
	};
	

//check q10
	temp = document.form1.q10[0].checked|document.form1.q10[1].checked|document.form1.q10[2].checked|document.form1.q10[3].checked|document.form1.q10[4].checked|document.form1.q10[5].checked;
	if(temp == false){
	alert("「曾有不好的診療經驗」尚未勾選！");return false;
	};
	
//check t1
	temp = document.form1.t1[0].checked|document.form1.t1[1].checked|document.form1.t1[2].checked|document.form1.t1[3].checked|document.form1.t1[4].checked|document.form1.t1[5].checked|document.form1.t1[6].checked|document.form1.t1[7].checked|document.form1.t1[8].checked|document.form1.t1[9].checked;
	if(temp == false){
	alert("「此次看診希望醫師為解決什麼問題」尚未勾選！");return false;
	};
}