﻿// JavaScript Document
function ismail(mail){
return(new RegExp(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/).test(mail));
}
function PostCheck(FmObj,Lg){
var msg1,msg2,msg3
if(Lg < 1 || Lg > 3) Lg = 1; 
if(FmObj.title.value==""){
	msg1 = "Sorry, the title cannot be left blank.";
	msg2 = "对不起，标题不能为空。";
	msg3 = "對不起，標題不能爲空。";
	eval("alert(msg" + Lg + ")");
	FmObj.title.focus();
	return false;
}

if(FmObj.text.value == ""){
	msg1 = "Sorry, the content connot be left blank.";
	msg2 = "对不起，内容不能为空。";
	msg3 = "對不起，內容不能爲空。";
	eval("alert(msg" + Lg + ")");
	FmObj.text.focus();
	return false;
}

if(FmObj.name.value==""){
	msg1 = "Sorry, Your name cannot be left blank.";
	msg2 = "对不起，请填写您的姓名。";
	msg3 = "對不起，請填寫您的姓名。";
	eval("alert(msg" + Lg + ")");
	FmObj.name.focus();
	return false;
}

var mail = FmObj.email.value;
if(!ismail(mail)){
	msg1 = "The Email address is not correct!";
	msg2 = "对不起，您填写的邮件地址有误，请查实！";
	msg3 = "對不起，您填寫的郵件地址有誤，請查實！";
	eval("alert(msg" + Lg + ")");
	FmObj.email.select();
	return false;}

if(FmObj.verifycode.value == ""){
	msg1 = "The verify code cannot be left blank.";
	msg2 = "验证码不能为空。";
	msg3 = "驗證碼不能爲空。";
	eval("alert(msg" + Lg + ")");
	FmObj.verifycode.focus();
	return false;}
return true;
}
