/*12软件沈俊坚    ------ 一系列的功能页*/
Namespace.register("UJ.Fnx");
/*在加载跨域后执行*/
U.CD.AsynJWH = function () {
    //U.ACD.Request(U.CD.AjaxUrl, ([U.CD.Host, U.CD.Database, "UJ_S_SelectDeep"]), UJ.Fnx.Tour, (["", "bb"]));
}
/*更换验证码*/
UJ.Fnx.ChangeImg = function () {
    var ver_li = $("#ver_li")[0]
    var Ver_img = $("#Ver_img")[0];
    Ver_img.parentNode.removeChild(Ver_img)
    $$("img", { "id": "Ver_img", "className": "Ver_img", "src": "http://main.1473.cn/Mian.ashx?functionname=UseStudioManage.Verification&n=" + Math.random() * 1 + "", "title": "看不清换一张", "onclick": [[UJ.Fnx.ChangeImg, ([])]] }, ver_li);
}
/*判断显示出现*/
UJ.Fnx.showHide = function (hideDiv, showDiv, isflg, bannerID) {
    switch (isflg) {
        case 0: //登录注册
            UJ.Fnx.ExShowHide(["User_Content", "Personal_info", hideDiv, "UJ_Child", "UJ_toor_lsit", "UJ_T_B_H", "UJ_Banner", "CoLayout"], [showDiv, "UJ_C", "User"], "0px", "430px");
            break;
        case 1: //主页
            UJ.Fnx.ExShowHide(["Personal_info", hideDiv, "UJ_Child", "User_login", "User_reg", "User"], [showDiv, "UJ_toor_lsit", "UJ_T_B_H", "UJ_Banner", "CoLayout"], "413px", "3920px");
            $("UJ_C")[0].style.marginTop = "49px";
            break;
        case 2: //Banner 子页面
            if (!$("#UJ_Child")[0]) { UJ.Cre.banner(bannerID); }
            UJ.Fnx.ExShowHide(["Personal_info", "User_login", "User_reg", "UJ_C", "CoLayout", "UJ_Banner", "UJ_toor_lsit", "UJ_T_B_H", "User"], ["UJ_Child"], "0px", "");
            break;
        case 3: //用户信息子页面
            UJ.Fnx.ExShowHide([hideDiv, "User_login", "User_reg", "UJ_Child", "UJ_toor_lsit", "UJ_T_B_H", "UJ_Banner", "CoLayout", "UJ_C"], [showDiv], "0px", "0");
            break;
        default: break;
    }
}
/*执行操作*/
UJ.Fnx.ExShowHide = function (hideDiv, showDiv, HeightPX, UJ_Height) {
    $("#UJ_toor_lsit").animate({ "height": HeightPX }, 100);
    $("#UJ_C")[0].style.height = UJ_Height;
    UJ.Fnx.ExHs(hideDiv, "none");
    UJ.Fnx.ExHs(showDiv, "block");
}
/*隐藏显示操作*/
UJ.Fnx.ExHs = function (Ud, isHide) {
    for (var i = 0; i < Ud.length; i++) {
        if ($("#" + Ud[i])[0]) {
            $("#" + Ud[i])[0].style.display = isHide;
        }
        for (var j = 0; j < Ud[i].length; j++) {
            if ($("#" + Ud[i][j])[0]) {
                $("#" + Ud[i][j])[0].style.display = isHide;
            }
        }
    }
}
/*左边导航*/
UJ.Fnx.Tour = function (r) {
    var tour_list = $("#UJ_toor_lsit")[0];
    tour_list.innerHTML = "";
    $("#UJ_toor_lsit").animate({ "height": "413px" }, 100);
    for (var i = 0; i < r.value[0].length; i++) {
        var a = $$("div", {}, tour_list);
        $$("a", { "innerHTML": r.value[0][i].name }, a);
    }
}
/*用户键盘登录*/
UJ.Fnx.keydown = function () {
    if ($("#CoLayout")[0].style.display == "none") {
        $("#User_login")[0] ? ($("#User_login")[0].style.display == "block" ? UJ.User.login("login_reg") : "")
        : ($("#User_reg")[0].style.display == "block" ? UJ.User.login("login_reg") : "");
    }
}
/*改变左边导航当前选中的*/
UJ.Fnx.Tour_onclick = function (a, id, c) {
    var par = $("#" + a.id)[0]; // $("#User_Content_left")[0];
    var child = par.children;
    for (var i = 1; i < child.length; i++) {
        for (var j = 1; j < child[i].children.length; j++) {
            var d = child[i].children[j].children[c];
            if (c == 1) {
                var d = child[i].children[j].children[c].children[0];
            }
            d.parentNode.style.background = "url(../../img/Help/Bjgray.jpg) no-repeat 20px 20px";
            d.style.color = "#555";
            d.onmouseover = function () {
                this.style.color = "#d62f75";
            }
            d.onmouseout = function () {
                if (this.innerHTML == $("#" + id)[0].children[0].innerHTML) { return; }
                this.style.color = "#555";
            }
        }
    }
    $("#" + id)[0].style.background = "url(../../img/Help/Bjred.jpg) no-repeat 20px 20px";
    $("#" + id)[0].children[0].style.color = "#d62f75";
}
/*动态创建select下拉框*/
//a 是className b是开始 c是结束 d是数组 e是位置 f是父ID g是谁可以点击，可传可不传
UJ.Fnx.Select = function (a, b, c, d, e, f, g) {
    if (!$("#" + a)[0]) {
        var ul = $$("ul", { "id": a, "className": a, "style": { "left": e.offsetLeft + "px", "top": e.offsetTop + 25 + "px", "position": "absolute", "z-index": "40", "border": "1px solid #ccc", "overflow-y": "auto"} }, $("#" + f)[0]);
        if (g != "") {
            $("#" + g)[0].style.position = "relative";
        }
        var bg = $$("div", { "id": "UJ_bg", "style": { "height": US.Height - 62 + "px", "width": US.Width - 2 + "px", "position": "absolute", "left": "0", "top": "0", "z-index": "38"} }, $("body")[0])
        if (parseInt(ul.style.height) > 300) { ul.style.height = "300px" }
        $(".Edu").animate({ "height": "260px" }, 300, function () {
            for (var i = b; i < c; i++) {
                var o = $$("li", {}, ul);
                $$("a", { "innerHTML": d[i][0], "onclick": [[UJ.Fnx.UpdateValue, ([e, d[i][0], ul, bg])]] }, o);
            }
        });
        bg.onclick = function () { UJ.Fnx.UpdateValue("", "", ul, bg) }
    }
}
/*下拉框，点击修改内容*/
UJ.Fnx.UpdateValue = function (a, b, c, d) {
    $("#" + c.id).remove();
    $("#" + d.id).remove();
    if (a != "" && b != "") {
        $("#" + a.id)[0].value ? $("#" + a.id)[0].value = b : $("#" + a.id)[0].innerHTML = b;
    }
    $("#User_Content_left")[0].style.position = "";
}
/*键盘事件*/
document.onkeydown = function (e) {
    var ev = event || e;
    if (ev.keyCode == 13) {
        UJ.Fnx.keydown();
    }
}
