// JavaScript Document

var check_form;

function setFromCheck(){
	check_form = document.getElementById("content-form");
	   if(check_form.addEventListener){
	       check_form.addEventListener("submit",from_submit,false);
		}else if(check_form.attachEvent){
	       check_form.attachEvent("onsubmit",from_submit);
		}else if(check_form.onclick){
	       check_form.onsubmit=from_submit;
		}
	
}



function from_submit(evnt){
	if(noKeyIn(check_form.username, "您的姓名未輸入")){
		if(evnt.cancelable){evnt.preventDefault();}else{return false;}
	}else if(noKeyIn(check_form.email, "您的電子信箱未輸入")){
		if(evnt.cancelable){evnt.preventDefault();}else{return false;}
	}else if(chkEmail(check_form.email, "您的電子信箱格式不正確")){
		if(evnt.cancelable){evnt.preventDefault();}else{return false;}
	}else if(noKeyIn(check_form.phone, "您的聯絡電話未輸入")){
		if(evnt.cancelable){evnt.preventDefault();}else{return false;}
	}else if(noKeyIn(check_form.attn, "您尚未選擇相關服務")){
		if(evnt.cancelable){evnt.preventDefault();}else{return false;}
	}else if(noKeyIn(check_form.meal, "您尚未選擇相關服務")){
		if(evnt.cancelable){evnt.preventDefault();}else{return false;}
	}else if(noKeyIn(check_form.notes, "您的聯絡訊息未輸入")){
		if(evnt.cancelable){evnt.preventDefault();}else{return false;}
	}
}
