﻿function check_UserName(username){
    var isValidUserName=false; var str=username;
    var Expression=/^(\w){4,10}$/;  var objExp =new RegExp(Expression);
    if(objExp.test(str)==true) {
        isValidUserName=true;}
    return isValidUserName;
}
function check_UserPwd(password){
    var isValidPassword =false; var str=password;
    var Expression=/^[A-Za-z]{1}([A-Za-z0-9]|[._]){3,19}$/; var objExp =new RegExp(Expression);
    if(objExp.test(str)==true){
        isValidPassword =true;}
    return isValidPassword;
}
function check_FormEmpty(Form){
    var cansubmit=true;
    for(var i=0;i<Form.length;i++){
        if(Form.elements[i].value=""){
            alert(Form.elements[i].title+" not allow empty");
            Form.elements[i].focus(); cansubmit=false;
   }}
   return cansubmit;
}
function checkLogin(){
  var invalidChars=new RegExp(/["<",">"]+/);
 if(document.getElementById("userID").value==""){
 document.getElementById("fail").innerText=" Warning:\r\n Please input your UserID.";
return false;
}else if(document.getElementById("userID").value.match(invalidChars)){
   document.getElementById("fail").innerText="Symbols '< ,>' are not allowed in a user ID.\r\nPlease reenter the user ID or contact customer";
   return false;
}else if(document.getElementById("password").value==""){
 document.getElementById("fail").innerText=" Warning:\r\n Please input your Password";
return false;
}else if(document.getElementById("password").value.match(invalidChars)){
   document.getElementById("fail").innerText="Symbols '< ,>' are not allowed in a password.\r\nPlease reenter the password or contact customer";
   return false;
}else{
return true;
}}

