$(function () {
    function ValidTemp() {
        var SiteName = $("#SiteName"), SiteTel = $("#SiteTel"),
                SiteTitle = $("#SiteTitle"),
                keywords = $("#keywords"),
                description = $("#description"),
                FootContact = $("#FootContact"),
                SmtpServer = $("#SmtpServer"),
                SmtpUserName = $("#SmtpUserName"),
                SmtpSender = $("#SmtpSender"),
                AdminMail = $("#AdminMail"),
                vCurrency = $("#vCurrency"),
                BackMoney = $("#BackMoney"),
                allFields = $([])
                .add(SiteName).add(SiteTel)
                .add(SiteTitle)
                .add(keywords)
                .add(description)
                .add(FootContact)
                .add(SmtpServer)
                .add(SmtpUserName)
                .add(SmtpSender)
                .add(AdminMail)
                .add(vCurrency)
                .add(BackMoney)
        ;
        var bValid = true;
        bValid = bValid && checkLength(SiteName, "网站名称", 1, 255);
        bValid = bValid && checkLength(SiteTel, "联系电话", 1, 50);
        bValid = bValid && checkLength(SiteTitle, "网站标题", 1, 255);
        bValid = bValid && checkLength(keywords, "网站关键字", 1, 255);
        bValid = bValid && checkLength(description, "网站描述", 1, 255);
        bValid = bValid && checkLength(SmtpServer, "Smtp服务器地址", 1, 255);
        bValid = bValid && checkLength(SmtpUserName, "邮件服务器登录名", 1, 255);
        bValid = bValid && checkLength(SmtpSender, "发件人", 1, 2147483647);
        bValid = bValid && checkLength(AdminMail, "管理员邮箱", 0, 2147483647);
        bValid = bValid && checkNumlength(vCurrency, "积分", 0, 2147483647);
        bValid = bValid && checkNumlength(BackMoney, "返现比例", 0, 2147483647);
        return bValid;
    };
    $("form").submit(function () {
        if(!ValidTemp())
        {
            $(this).find("button[type=submit]").removeClass("loading").removeAttr("disabled");
            return false;
        }
    });
});