$(function () {
    function ValidTemp() {
        var PlanName = $("#PlanName"),
        RunTime = $("#RunTime"),
        PlanType = $("#PlanType"),
        PlanAction = $("#PlanAction"),
        MeetNum = $("#MeetNum"),
        intevalDay = $("#intevalDay")
        allFields = $([])
        .add(PlanName)
        .add(RunTime)
        .add(MeetNum)
        .add(intevalDay)
        ;
        var bValid = true;
        bValid = bValid && checkLength(PlanName, "任务名称", 1, 50);
        bValid = bValid && checkRegexp(RunTime, Regex_Time, "时间格式不正确");
        bValid = bValid && checkNumlength(MeetNum, "邮件通知次数", 1, 255);
        bValid = bValid && checkNumlength(intevalDay, "间隔天数", 1, 365);
        return bValid;
    };
    $("form").submit(function () {
        if (!ValidTemp()) {
            $(this).find("button[type=submit]").removeClass("loading").removeAttr("disabled");
            return false;
        }
    });
});