// JavaScript Document

function checkComment() {
	var form=document.frmComment;	
	if (form.txtName.value=="") {
		alert("กรุณาระบุชื่อ !\nPlease fill your name !"); form.txtName.focus();	
	} else if (form.txtEmail.value=="") {
		alert("กรุณาระบุอีเมล !\nPlease fill your email address !"); form.txtEmail.focus();
	} else if (!checkmail2(form.txtEmail.value)) {
		alert("รูปแบบอีเมล์ไม่ถูกต้อง !\nInvalid email address.");	form.txtEmail.select();
	} else if (form.txtDetail.value=="") {
		alert("กรุณาระบุข้อความ !\nPlease fill you description."); form.txtDetail.focus();		
	} else {	
		return true;
	}
	return false;
}

function return_send(sta) {	
	//var code=document.getElementById("recaptcha_response_field");
	if (sta=='empty') {
		alert("รหัสสำหรับตรวจสอบไม่ถูกใส่\nVerification wrong.");
	} else if (sta=="true") {
		var URL=window.location;
		window.location.href=URL;
	} else if (sta=="err_code") {
		alert("รหัสสำหรับตรวจสอบไม่ถูกต้อง\nVerification wrong.");
		//code.style.background="#ffffcc";
		//code.focus();
	} else {
		alert("เกิดข้อผิดพลาด ! ไม่สามารถส่งข้อความได้ในขณะนี้\nError ! Please try again later.");
	}

}

function return_send_reply(sta) {	
	//var code=document.getElementById("recaptcha_response_field");
	if (sta=='empty') {
		alert("รหัสสำหรับตรวจสอบไม่ถูกใส่\nVerification wrong.");
	} else if (sta=="true") {
		var URL=window.location;
		window.location.href=URL;
	} else if (sta=="err_code") {
		alert("รหัสสำหรับตรวจสอบไม่ถูกต้อง\nVerification wrong.");
		//code.style.background="#ffffcc";
		//code.focus();
	} else {
		alert("เกิดข้อผิดพลาด ! ไม่สามารถส่งข้อความได้ในขณะนี้\nError ! Please try again later.");
	}

}


/*/----For Check Email value-----------------------------------------*/
var emailfilter2=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
function checkmail2(e){
	var returnval=emailfilter2.test(e)
	return returnval
}
