﻿//验证是否为空
function CheckEmpty(txtBox)
{
    if(txtBox.value.length==0)
    {
        return false;
    }
    return true;
}
//限制长度
function RestrictLength(txtBox,maxLength)
{
    while(txtBox.value.length>maxLength)
    {
        txtBox.value=txtBox.value.slice(0,-1);
    }
}
//检查textbox是否为空,并显示相关信息
function CheckTextBoxEmpty(txtBox)
{
    var boolFirstNameValidated=false;
    var corrmsgID=txtBox.getAttribute("corrmsgID");
    var errmsgID=txtBox.getAttribute("errmsgID");
    var spCorrectMsg=document.getElementById(corrmsgID);
    var spErrorMsg=document.getElementById(errmsgID);
    spCorrectMsg.style.display="none";
    spErrorMsg.style.display="none";
    boolTextBoxValidated=CheckEmpty(txtBox);
    if(boolTextBoxValidated)
    {
        spCorrectMsg.style.display="";
    }
    else
    {
        spErrorMsg.style.display="";
    }
    return boolFirstNameValidated;
}

function validateMailAddress(strMailAddress)
{
    var pattern = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
    return pattern.test(strMailAddress);
}

//限制长度
function RestrictLength(objTxt,maxLength)
{
    while(objTxt.value.length>maxLength){objTxt.value=objTxt.value.slice(0,-1);}
}

//guilin 添加
function Display( boxID , noneORBlock )
{
    document.getElementById(boxID).style.display = noneORBlock;
}


//去掉左右空格
function Trim(value)
{
    return value.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,"");
}


