// JavaScript Document
function echeck(str) {
var at="@";
var dot=".";
var lat=str.indexOf(at);
var lstr=str.length;
var ldot=str.indexOf(dot);
if (str.indexOf(at)==-1) return false;
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) return false;
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) return false;
if (str.indexOf(at,(lat+1))!=-1) return false;
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) return false;
if (str.substring(ldot-1,ldot)=="" || str.substring(ldot+1,ldot+2)=="") return false;
if (str.substring(ldot-1,ldot)==dot || str.substring(ldot+1,ldot+2)==dot) return false;
if (str.indexOf(dot,(lat+2))==-1) return false;
if (str.indexOf(" ")!=-1) return false;
return true;}
function validateForm(type) {
with (document.confirm) {
var alertMsg = "กรุณาระบุ";
if (bank.options[bank.selectedIndex].value == "") alertMsg += "\nธนาคาร :";
if (branch.value == "") alertMsg += "\nสาขา :";
if (type.options[type.selectedIndex].value == "") alertMsg += "\nวิธีชำระเงิน :";
if (payment_day.options[payment_day.selectedIndex].value == "") alertMsg += "\nวันที่ชำระเงิน :";
if (payment_month.options[payment_month.selectedIndex].value == "") alertMsg += "\nวันที่ชำระเงิน : (เดือน)";
if (payment_time_hour.options[payment_time_hour.selectedIndex].value == "") alertMsg += "\nเวลาชำระเงิน : (ชั่วโมง)";
if (payment_time_minute.options[payment_time_minute.selectedIndex].value == "") alertMsg += "\nเวลาชำระเงิน : (นาที)";
if (total_price.value == "") alertMsg += "\nจำนวนเงิน :";
if (firstname.value == "") alertMsg += "\nชื่อ (First name)";
if (lastname.value == "") alertMsg += "\nสกุล (Last name)";
if ((email.value==null)||(email.value=="")) alertMsg += "\nอีเมล์ (E-mail)";
else{if (echeck(email.value)==false) alertMsg += "\nอีเมล์ที่ถูกต้อง";}
if (id.value == "") alertMsg += "\nรหัสอ้างอิง :";
if (alertMsg != "กรุณาระบุ") {
alert(alertMsg);
return false;
} else {
return true;
} } }
