﻿
function isChecked() {
if(document.Form1.sentx.checked == true){
	document.Form1.email.disabled=false;
        

      }else {
	document.Form1.email.value='';
	document.Form1.email.disabled=true;
	
        
      } 
}

function round(x) {
  return Math.round(x*100)/100;
}

function Comma(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

function formValidation(form){
if(notEmpty(form.domain)){
if(notEmpty(form.fname)){
if(notEmpty(form.lname)){
if(notEmpty(form.address)){
if(notEmpty(form.province)){
if(notEmpty(form.zip)){
if(notEmpty(form.tel)){
if(notEmpty(form.email)){
return true;
}
}
}
}
}
}
}
}
return false;
}
function notEmpty(elem){
var str = elem.value;
if(str.length == 0){
alert("กรุณากรอกข้อมูลให้ครบทุกช่อง");
return false;
} else {
return true;
}
}

function verifyEmail(form){
checkEmail = document.Form1.email.value
if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-5) != '.') && (checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))) 
{alert("รูปแบบอีเมล์ผิด กรุณาลองอีกที");
document.Form1.email.select();
} 
}


