var City = new U.CityT();   //调用地区控件

Namespace.register("U.School"); //自定义回话框等区域
U.School = function (Udiv, Uit) {
    var _UT = new U.SchoolT(Udiv);
    _UT.init();
    return _UT;
}
U.SchoolT = function (Udiv, Uit) {
    this.Udiv = Udiv;
    this.Uit = Uit;
}
U.SchoolT.prototype = {
    init: function () {
        this.Odiv();
        this.sumbit(this.Uit);
    },
    Odiv: function () {
        this.winWidth = document.body.offsetWidth
        var U_S_Out = $$("div", { "id": "U_S_Out", "className": "U_C_Out" }, this.Udiv);
        var U_S_O_L = $$("div", { "id": "U_S_O_L", "className": "U_C_O_L U_C_left", "innerHTML": "教育信息:" }, U_S_Out);
        var U_S_O_R = $$("div", { "id": "U_S_O_R", "className": "U_C_O_R U_C_right" }, U_S_Out);
        var U_S_O_C = $$("div", { "id": "U_S_O_C", "className": "U_C_O_C U_C_left", "innerHTML": "未填写教育信息" }, U_S_O_R);
        var U_S_O_R_D = $$("div", { "id": "U_S_O_R_D", "className": "U_C_O_R_T U_C_right", "innerHTML": "编辑", "onclick": [[this.view, ([this])]] }, U_S_O_R);
    },
    view: function (_this) {
        var r = U.ACD.Request(U.CD.AjaxUrl, ([U.CD.Host, U.CD.Database, "US_S_Select_place"]), "", (["", "bb", _this]));
        var U_S_Out = $("#U_S_Out").animate({ "height": "100px" }, 200);
        var U_S_Content = $$("div", { "id": "U_S_Content", "className": "U_S_Content" }, U_S_Out);
        var U_S_O_R = $("#U_S_O_R")[0];
        $("#U_S_O_R_D")[0].style.display = "none";
        $("#U_S_O_C")[0].style.display = "none";
        $$("div", { "id": "U_S_O_R_P", "className": "U_C_O_R_T U_C_right", "innerHTML": "收起", "onclick": [[City.pickup, ([U_S_Content, "S"])]] }, U_S_O_R);
        $$("div", { "id": "U_S_O_R_Remind", "className": "U_C_O_R_Remind", "innerHTML": "填写教育信息，能帮助你在微博上快速找到许久不见的老同学" }, U_S_Content)
        var U_S_Content_D = $$("div", { "id": "U_S_Content_D", "className": "U_S_Content_D" }, U_S_Content);
        $$("div", { "innerHTML": "学校名称", "className": "U_S_T_right U_C_left", "style": { "width": "55px"} }, U_S_Content_D);
        var U_S_icon = $$("div", { "id": "U_S_icon", "className": "U_S_icon" }, U_S_Content_D)
        var U_S_input = $$("input", { "className": "U_S_input", "type": "text", "id": "U_S_input", "placeholder": "点击选择学校", "onclick": [[_this.place, ([r])]] }, U_S_icon)
        if (_this.value) {
            U_S_input.value = _this.value;
        }
    },
    place: function (r) {
        $("#U_S_input")[0].blur();
        var U_S_N_D = $$("div", { "id": "U_S_N_D", "className": "U_S_N_D", "style": { "width": US.Width + "px", "height": US.Height + "px"} }, $("body")[0])
        var U_S_N_B = $$("div", { "id": "U_S_N_B", "className": "U_S_N_B", "style": { "left": (US.Width - 860) / 2 + "px", "top": (US.Height - 392) / 2 + "px"} }, $("body")[0]);
        var U_S_Title = $$("div", { "className": "U_S_Title" }, U_S_N_B)
        $$("div", { "innerHTML": "选择学校", "title": "选择学校", "className": "U_C_left" }, U_S_Title);
        $$("div", { "id": "U_S_B_Close", "className": "U_S_B_Close U_C_right", "onclick": [[City.destroy, (["", [U_S_N_D, U_S_N_B]])]], "innerHTML": "×" }, U_S_Title)
        var U_S_B = $$("div", { "id": "U_S_B", "className": "U_S_B" }, U_S_N_B);
        var U_S_B_L_T = $$("div", {}, U_S_B);
        $$("div", { "innerHTML": "城市选择:", "className": "U_S_color U_C_left" }, U_S_B_L_T);
        $$("div", { "innerHTML": "学校选择:", "className": "U_S_color U_C_left", "style": { "margin-left": "190px"} }, U_S_B_L_T);
        var U_S_B_L = $$("div", { "id": "U_S_B_L", "className": "U_S_B_L U_C_left" }, U_S_B);
        var U_S_B_L_Pro = $$("div", {}, U_S_B_L)
        for (var i = 0; i < r.value[0].length; i++) {
            var U_S_Select = $$("div", { "id": "U_S_Select_" + i, "className": "U_S_Select U_C_left U_C_Select", "innerHTML": r.value[0][i].place, "onclick": [[r.context[2].call, ([[r.value[0][i].place, r.context[2], "U_S_Select_" + i]])]] }, U_S_B_L_Pro)
            if (r.value[0][i].place == r.context[2].area) {
                U_S_Select.style.border = "1px solid #A6A1A1";
            }
        }
        var U_S_B_L_Text = $$("div", { "id": "U_S_B_L_Text", "className": "U_S_B_L_Text" }, U_S_B_L);
        var U_S_B_L_Nofind = $$("div", { "innerHTML": "找不到我学校?", "className": "U_C_M_B_Text U_S_B_L_Nofind" }, U_S_B_L_Text);
        var U_S_B_L_input = $$("input", { "id": "U_S_B_L_input", "className": "U_C_B_L_input U_S_B_L_input", "placeholder": "例子：广东-深圳技师学院", "type": "text" }, U_S_B_L_Text)
        var U_S_B_L_submit = $$("div", { "id": "U_S_B_L_submit", "className": "U_S_B_L_submit" }, U_S_B_L_Text)
        var U_S_B_L_submit_t = $$("div", { "innerHTML": "确定", "onclick": [[r.context[2].YOrF, ([U_S_B_L_input, r])]] }, U_S_B_L_submit)
        U_S_B_L_Nofind.onclick = function () { U_S_B_L_input.focus() }
        var U_S_B_R = $$("div", { "id": "U_S_B_R", "className": "U_S_B_R U_C_left" }, U_S_B);
        U.ACD.Request(U.CD.AjaxUrl, ([U.CD.Host, U.CD.Database, "US_S_Select_school", r.context[2].area ? r.context[2].area : "北京"]), r.context[2].school, (["", "bb", r.context[2], "北京"]));
    },
    call: function (r) {
        for (var i = 0; i < 33; i++) {
            $("#U_S_Select_" + i)[0].className = "U_S_Select U_C_left U_C_Select";
        }
        $("#" + r[2])[0].className = "U_S_Select U_C_left border U_C_Select";
        U.ACD.Request(U.CD.AjaxUrl, ([U.CD.Host, U.CD.Database, "US_S_Select_school", r[0]]), r[1].school, (["", "bb", r]));
    },
    YOrF: function (str, r) {
        var S = str.value.split("-");
        var flg = false;
        var reg = /[\u4E00-\u9FA5\uF900-\uFA2D]/;
        if (S.length != 2) { alert("填下信息有错，例子：广东-深圳技师学院"); return; }
        for (var i = 0; i < r.value[0].length; i++) {
            if (r.value[0][i].place == S[0]) { flg = true; break; }
        }
        if (flg == true) {
            if (reg.test(S[1])) {
                r.context[2].result([S[1], S[0], r.context[2]]);
            }
        } else { alert("输入的省份有错"); }
    },
    school: function (r) {
        U_S_B_R.innerHTML = "";
        var city, _this;
        r.context[3] != undefined ? city = r.context[3] : city = r.context[2][0];
        r.context[2][1] != undefined ? _this = r.context[2][1] : _this = r.context[2];
        for (var k = 0; k < r.value[0].length; k++) {
            $$("div", { "id": "U_S_School_" + k, "className": "U_S_School U_C_left", "innerHTML": r.value[0][k].name, "onclick": [[_this.result, ([[r.value[0][k].name, city, _this]])]] }, U_S_B_R);
        }
    },
    result: function (r) {
        $("#U_S_N_B")[0].parentNode.removeChild($("#U_S_N_B")[0]);
        $("#U_S_N_D")[0].parentNode.removeChild($("#U_S_N_D")[0]);
        r[2].area = r[1];
        $("#U_S_input")[0].value = r[2].value = r[0];
        $("#U_S_O_C")[0].innerHTML = r[0];
    },
    sumbit: function (Uit) {                   //这里是返回一个数组，  数组的值是用户选择的值
        if (Uit == undefined) {
            return;
        }
        Uit.onclick = (function (that) {
            return function () {

            }
        })(this)
    }
}
