﻿// JScript 文件

function btnClick()   
{       
  if(event.keyCode==13)   
  {   
      event.keyCode=9; 
      event.returnValue = false;   
      document.all("btnSave").click();     
  }   
}

function CheckEmploymentInfo(topic,linkName,tel,mobileTel,email,address,code)
{
    if (topic.value=="")
    {
        alert("主题不能为空！");
        topic.focus();
        return false;
    }
    else if (linkName.value=="")
    {
        alert("联系人不能为空！");
        linkName.focus();
        return false;
    }
    else if (tel.value=="")
    {
        alert("固定电话不能为空！");
        tel.focus();
        return false;
    }
    else if (mobileTel.value=="")
    {
        alert("移动电话不能为空！");
        mobileTel.focus();
        return false;
    }
    else if (email.value=="")
    {
        alert("Email不能为空！");
        email.focus();
        return false;
    }
    else if(EmailCheck(email.value)==false) 
    {
      alert("无效的Email！");
      email.focus();
      return false;
    }
    else if (address.value=="")
    {
        alert("地址不能为空！");
        address.focus();
        return false;
    }
    else if (code.value=="")
    {
        alert("验证码不能为空！");
        code.focus();
        return false;
    }
    else
        return true;
}


function CheckEmploymentInfoEn(topic,linkName,tel,mobileTel,email,address,code)
{
    if (topic.value=="")
    {
        alert("Please enter the subject!");
        topic.focus();
        return false;
    }
    else if (linkName.value=="")
    {
        alert("Please enter Link Man!");
        linkName.focus();
        return false;
    }
    else if (tel.value=="")
    {
        alert("Please enter the fixed telephone!");
        tel.focus();
        return false;
    }
    else if (mobileTel.value=="")
    {
        alert("Please enter the mobile phone!");
        mobileTel.focus();
        return false;
    }
    else if (email.value=="")
    {
        alert("Email can not be empty!");
        email.focus();
        return false;
    }
    else if(EmailCheck(email.value)==false) 
    {
      alert("Invalid Email!");
      email.focus();
      return false;
    }
    else if (address.value=="")
    {
        alert("Please enter the address!");
        address.focus();
        return false;
    }
    else if (code.value=="")
    {
        alert("Please enter the validate code!");
        code.focus();
        return false;
    }
    else
        return true;
}

function EmailCheck (obj) {
    var emailPat=/^(.+)@(.+)$/;
    var matchArray=obj.match(emailPat);
    if (matchArray==null) {
      return false;
    }
    return true;
}

