function save(el) {
    if ($("#myfile").val() == "") {
        alert("请选择导入的文件");
        return false;
    }

    if (confirm("确认导入？")) {
        $("form").submit();
    }

    //el = $(el);
    //if (el.attr("issub") == "1") {
    //    return false;
    //}
    //el.attr("issub", "1");

    //var elid = "SchoolID";
    //var BelongToID = el.attr("BelongToID");
    //if (BelongToID)
    //    elid = BelongToID;

    //var val = $("#" + elid).find("option:selected").text();
    //if (confirm("确认导入到: " + val + " ？")) {
    //    $("form").submit();
    //}
}

function update() {
    $("#updateschoolArea").submit();
}

function MyDictionary() {
    this.Keys = [];
    this.Values = [];

    this.getelements = function (key) {
        var array = [];
        for (var i = 0, len = this.Values.length; i < len; i++) {
            if (this.Values[i].key === key) {
                array.push(this.Values[i].value);
            }
        }

        return array;
    }

    this.Add = function (key, value) {
        var tflag = this.ContainsKey(key);
        if (!tflag) {
            this.Keys.push(key);
        }

        this.Values.push({ key: key, value: value });
    };
    this.ContainsKey = function (key) {
        var tflag = false;
        for (var i = 0, len = this.Keys.length; i < len; i++) {
            if (this.Keys[i] === key) {
                tflag = true;
                break;
            }
        }

        return tflag;
    }
}

function ss(bol, url, isBtnSearch) {
    var pars = [];

    var dic = new MyDictionary();

    var isValid = true;

    $("[mycontrol=1][controltype='5']").each(function () {
        var el = $(this);

        var id = el.attr("id");
        var val = el.val();
        var rule = el.attr("rule");
        var reqx = el.attr("myRequired");

        if (isBtnSearch && val == "" && reqx === "1") {
            isValid = false;
            //暂时这么写 
            alert(el.parent().parent()[0].innerText + "不能为空！")
            return false;
        }

        //if (el.is("select") && el.attr("istext") == "1") {
        //    val = el.find("option:selected").text();
        //}
        if (el.is("select") && val != "-1") {
            var par = id + "=" + val;
            pars.push(par);
        }
        else if (!el.is("select")) {
            if (rule === "6" && el.is(':checked')) {
                dic.Add(el.attr("name"), el.attr("avalue"));
            }
            else {
                var par = id + "=" + val;
                pars.push(par);
            }
        }
    });

    if (!isValid) {
        return;
    }

    for (var i = 0, len = dic.Keys.length; i < len; i++) {
        var values = dic.getelements(dic.Keys[i]);
        pars.push(dic.Keys[i] + "=" + values);
    }

    if (isBtnSearch) {
        pars.push("isBtnSearch=true");
    }

    var str = "?";
    var count = pars.length;
    $(pars).each(function (i) {
        str += this + (i == (count - 1) ? "" : "&");
    });

    var page = 0;//QueryString("page");
    if (page > 0)
        str += "&page=" + page;

    if (bol) {
        window.location.href = url + decodeURIComponent(str);
    } else {
        window.location.href = window.location.pathname + decodeURIComponent(str);
    }
}