
/// <reference path="jquery-1.4.1-vsdoc.js" />


////   1. ^[\u2E80-\u9FFF]+$     
////   2. 匹配所有东亚区的语言     
////   3. ^[\u4E00-\u9FFF]+$     
////   4. 匹配简体和繁体     
////   5. ^[\u4E00-\u9FA5]+$     
////   6. 匹配简体  


//验证邮箱正则
var regEmail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;

//验证中英文正则
var regChEn = /^([\u4E00-\u9FA5\uF900-\uFA2D]|[a-zA-Z]){0,}$/;

//验证邮编正则
var regZipCode = /^\d+$/;

//验证中国手机正则
var regMobileChs = /^0{0,1}(13[0-9]|15[0-9]|18[0-9])[0-9]{8}$/;

//验证数字格式正则
var regNum = /^\d+$/;

//验证英文输入正则
//var regEn = /^[^\u2E80-\u9FFF]{0,}$/;
var regEn = /^[\x00-\xff]{0,}$/;

//验证网址url正则
var regUrl = /^http:\/\/[0-9a-zA-Z\.\-\_]{1,}$/;
var regwUrl = /^www[0-9a-zA-Z\.\-\_]{1,}$/;

////验证密码
//var regPassword = /^[0-9a-zA-Z\.\_]{4,12}$/;

///-----------------------------
//数字
function checkNum(num) {
    if (regNum.test(num)) {
        return true;
    }
    else {
        return false;
    }
}
//英文
function checkEnglish(str) {
    if (regEn.test(str)) {
        return true;
    }
    else {
        return false;
    }
}
//网址
function checkUrl(url) {
    if (regwUrl.test(url)) {
        return true;
    } else {
        return false;
    }
}
//邮箱
function checkEmail(email) {
    if (regEmail.test(email)) {
        return true;
    } else {
        return false;
    }
}

//中英文
function checkChEn(str) {
    if (regChEn.test(str)) {
        return true;
    } else {
        return false;
    }
}

//密码
function checkPassword(str) {
    if (str.length >= 4 && str.length <= 12) {
        return true;
    } else {
        return false;
    }
}




///------------------------------字段验证--------------------------------------
//邮箱
function Email_Check(name, value) {
    var error = "";
    if ($.trim(value) == "") {
        error = name + "不能为空！";
        return error;
    }
    if (regEmail.test(value) == false) {
        error = name + "格式不正确！";
        return error;
    }
    return error;
}

function Email_CheckNoNull(name, value) {
    var error = "";
    if ($.trim(value) != "") {
        if (regEmail.test(value) == false) {
            error = name + "格式不正确！";
            return error;
        }
    }
    return error;
}


//登陆密码
function Password_Check(name, value) {
    var error = "";
    if ($.trim(value) == "") {
        error = name + "不能为空！";
        return error;
    }
    if ($.trim(value).length < 4 || $.trim(value).length > 12) {
        error = name + "长度为4-12个字符！";
        return error;
    }
    return error;
}
//姓
function FirstEName_Check(name, value) {
    var error = "";
    if ($.trim(value) == "") {
        error = name + "不能为空！";
        return error;
    }
    if (regChEn.test(value) == false) {
        error = name + "只能是中文或英文！";
        return error;
    }
    return error;
}
//名
function LastEName_Check(name, value) {
    var error = "";
    if ($.trim(value) == "") {
        error = name + "不能为空！";
        return error;
    }
    if (regChEn.test(value) == false) {
        error = name + "只能是中文或英文！";
        return error;
    }
    return error;
}
//名
function Name_Check(name, value) {
    var error = "";
    if ($.trim(value) == "") {
        error = name + "不能为空！";
        return error;
    }
    if (regChEn.test(value) == false) {
        error = name + "只能是中文或英文！";
        return error;
    }
    return error;
}
//职务
function Rank_Check(name, value) {
    var error = "";
    if ($.trim(value) == "") {
        error = name + "不能为空！";
        return error;
    }
    if (regChEn.test(value) == false) {
        error = name + "只能是中文或英文！";
        return error;
    }
    return error;
}
//公司名称
function CompanyName_Check(name, value) {
    var error = "";
    if ($.trim(value) == "") {
        error = name + "不能为空！";
        return error;
    }
    return error;
}
//公司英文名称
function CompanyEName_Check(name, value) {
    var error = "";
    if ($.trim(value) == "") {
        error = name + "不能为空！";
        return error;
    }
    return error;
}
//地址
function Address_Check(name, value) {
    var error = "";
    if ($.trim(value) == "") {
        error = name + "不能为空！";
        return error;
    }
    return error;
}
//英文地址
function EAddress_Check(name, value) {
    var error = "";
    if ($.trim(value) == "") {
        error = name + "不能为空！";
        return error;
    }
    return error;
}
//邮编
function ZipCode_Check(name, value) {
    var error = "";
    if ($.trim(value) == "") {
        error = name + "不能为空！";
        return error;
    }
    if (regZipCode.test(value) == false) {
        error = name + "只能输入数字";
        return error;
    }
    return error;
}
//手机(中国)
function Mobile_Check_China(name, value) {
    var error = "";
    if ($.trim(value) == "") {
        error = name + "不能为空！";
        return error;
    }
    if (regNum.test(value) == false) {
        error = name + "只限输入数字！";
        return error;
    }
    if (regMobileChs.test(value) == false) {
        error = name + "格式不符合规范，应为11位13,15,18开头！"
        return error;
    }
    return error;
}
//手机（国外）
function Mobile_Check_Foreign(name, value) {
    var error = "";
    if ($.trim(value) == "") {
        error = name + "不能为空！";
        return error;
    }
    if (regNum.test(value) == false) {
        error = name + "只限输入数字！";
        return error;
    }
    if ($.trim(value).length < 7) {
        error = name + "长度必须大于7位！";
        return error;
    }
    return error;
}
//网址
//function WebUrl_Check(name, value) {
//    var error = "";
//    if ($.trim(value) == "") {
//        error = name + "不能为空！";
//        return error;
//    }
//    return error;
//}


//地址
function BrdName_Check(name, value) {
    var error = "";
    if ($.trim(value) == "") {
        error = name + "不能为空！";
        return error;
    }
    return error;
}