﻿// JScript 文件

function checkString(checkV)
{
      var i=0;
      var str="0123456789abcdefghijklmnopqrstuvwxyz_";
      var strLen=checkV.length;
      while((i<strLen))
      {
        var char=checkV.charAt(i).toLowerCase();;
        if(str.indexOf(char)==-1)
         return false;
        i++;
      }
      return true;
}

function SubmitKeyClick(button) 
{    
     if (event.keyCode == 13) 
     {        
      event.keyCode=9; 
      event.returnValue = false; 
      document.all[button].click(); 
     } 
}

/*个人会员登录*/
function checkPersonLogin()
{
    var _username=document.getElementById("txtPuserName").value;
    var _userpwd=document.getElementById("txtPuserPwd").value;
    if(_username.length<6)
    {
        alert("请正确输入用户名！");
        document.getElementById("txtPuserName").focus();
        return false;
    }
    else if(!checkString(_username))
    {
        alert("请正确输入用户名！");
        document.getElementById("txtPuserName").focus();
        return false;
    }else if (_userpwd.length<6)
    {
        alert("请正确输入密码！");
        document.getElementById("txtPuserPwd").focus();
        return false;
    }
    else{return true;}
}

/*企业会员登录*/
function checkCompanyLogin()
{
    var _username=document.getElementById("txtCuserName").value;
    var _userpwd=document.getElementById("txtCuserPwd").value;
    if(_username.length<6)
    {
        alert("请正确输入用户名！");
        document.getElementById("txtCuserName").focus();
        return false;
    }
    else if(!checkString(_username))
    {
        alert("请正确输入用户名！");
        document.getElementById("txtCuserName").focus();
        return false;
    }else if (_userpwd.length<6)
    {
        alert("请正确输入密码！");
        document.getElementById("txtCuserPwd").focus();
        return false;
    }
    else{return true;}
}

/*培训机构登录*/
function checkTrainLogin()
{
    var _username=document.getElementById("txtTuserName").value;
    var _userpwd=document.getElementById("txtTuserPwd").value;
    if(_username.length<6)
    {
        alert("请正确输入用户名！");
        document.getElementById("txtTuserName").focus();
        return false;
    }
    else if(!checkString(_username))
    {
        alert("请正确输入用户名！");
        document.getElementById("txtTuserName").focus();
        return false;
    }else if (_userpwd.length<6)
    {
        alert("请正确输入密码！");
        document.getElementById("txtTuserPwd").focus();
        return false;
    }
    else{return true;}
}
