@*弹窗事件*@
<script type="text/javascript" language="javascript">
    var Item_Is_Load_Data=false;
    function Item_BatchAction() {
        $("#Item_BatchAction").show();
        initUIThree();

        if(Item_Is_Load_Data==false){
            $.fn.zTree.init($("#Item_TypeNames_Div_Tree"), Item_F_TypeNames_Setting);
            $.fn.zTree.init($("#Item_TypeName_Div_Tree"), Item_F_TypeName_Setting);
            $.fn.zTree.init($("#Item_F_RecommendTypeName_Div_Tree"), Item_F_RecommendTypeName_Setting);
            Item_Is_Load_Data=true;
        }

        //页面一打开就执行，放入ready是为了layer所需配件（css、扩展模块）加载完毕
        layer.ready(function () {
            layer.open({
                type: 1,
                zIndex: -1,
                shade: false,
                title: false, //不显示标题
                content: $('#Item_BatchAction'), //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
                area: ['580px', '580px'], //宽高
                cancel: function () {
                    layer.msg('操作完成', { time: 500, icon: 6 });
                }
                , end: function () {
                    $("#Item_BatchAction").css("display", "none");
                }
            });
        });
    }
</script>

@*左侧导航树形*@
@*<script type="text/javascript" language="javascript">
        var Item_Setting = {
            async: {
                enable: true,
                url: "/Manage/CmsType/Action_GetType",
                autoParam: ["id"],
                otherParam: { "typeid": Item_TypeId },
                dataFilter: Item_Filter
            },
            callback: {
                onClick: Item_OnClick
                //, onAsyncSuccess: Item_OnAsyncSuccess
            }
            , showLine: true
        };
        function Item_Filter(treeId, parentNode, childNodes) {
            if (!childNodes) return null;
            for (var i = 0, l = childNodes.length; i < l; i++) {
                childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
            }
            return childNodes;
        }
        function Item_OnClick(event, treeId, treeNode, clickFlag) {
            Item_TreeListChange(treeNode.id);
        }
        $(function () {
            $.fn.zTree.init($("#Item_Tree"), Item_Setting);
            //Item_TreeListChange(Item_TypeId);
        })
    </script>*@

@*推荐多选下拉树*@
<script type="text/javascript" language="javascript">
    var Item_F_RecommendTypeName_Setting = {
        check: {
            enable: true,
            chkboxType: { "Y": "", "N": "" }
        },
        view: {
            dblClickExpand: false
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            onClick: Item_F_RecommendTypeName_OnClick,
            onCheck: Item_F_RecommendTypeName_OnCheck
        }
        ,
        async: {
            enable: true,
            url: "/Manage/Recommend/Action_GetType",
            autoParam: ["id"],
            otherParam: { "typeid": Item_F_RecommendTypeId },
            dataFilter: Item_F_RecommendTypeName_Filter
        }
        , showLine: true,
    };

    function Item_F_RecommendTypeName_Filter(treeId, parentNode, childNodes) {
        if (!childNodes) return null;
        for (var i = 0, l = childNodes.length; i < l; i++) {
            childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
        }
        return childNodes;
    }

    function Item_F_RecommendTypeName_OnClick(event, treeId, treeNode, clickFlag) {
        var zTree = $.fn.zTree.getZTreeObj("Item_F_RecommendTypeName_Div_Tree");
        zTree.checkNode(treeNode, !treeNode.checked, null, true);
        return false;
    }

    function Item_F_RecommendTypeName_OnCheck(e, treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj("Item_F_RecommendTypeName_Div_Tree");

        nodes = zTree.getCheckedNodes(true),

        v = "";
        name = "";
        for (var i = 0, l = nodes.length; i < l; i++) {
            v += nodes[i].id + ',';
            name += nodes[i].name + ',';
        }

        $("#Item_F_RecommendTypeId").attr("value", v);
        $("#Item_F_RecommendTypeName").attr("value", name);
    }

    function Item_F_RecommendTypeName_ShowMenu() {
        $("#Item_F_RecommendTypeName_Div").css({ left: "150px", top: "93px" }).slideDown("fast");
        $("body").bind("mousedown", Item_F_RecommendTypeName_OnBodyDown);
    }

    function Item_F_RecommendTypeName_OnBodyDown(event) {

        if (!(
            event.target.id == "Item_F_RecommendTypeId"
            || event.target.id == "Item_F_RecommendTypeName_Div"
            || $(event.target).parents("#Item_F_RecommendTypeName_Div").length > 0
            )) {

            $("#Item_F_RecommendTypeName_Div").fadeOut("fast");
            $("body").unbind("mousedown", Item_F_RecommendTypeName_OnBodyDown);
        }

    }

    $(function () {
        //$.fn.zTree.init($("#Item_F_RecommendTypeName_Div_Tree"), Item_F_RecommendTypeName_Setting);
    })

</script>

@*单选树*@
<script type="text/javascript" language="javascript">

    var Item_F_TypeName_Setting = {
        check: {
            enable: true,
            chkStyle: "radio",
            radioType: "all"
        },
        view: {
            dblClickExpand: false
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            onClick: Item_F_TypeName_OnClick,
            onCheck: Item_F_TypeName_OnCheck
        }
        ,
        async: {
            enable: true,
            url: "/Manage/CmsType/Action_GetType",
            autoParam: ["id"],
            otherParam: { "typeid": Item_TypeId },
            dataFilter: Item_F_TypeName_Filter
        }
        , showLine: true,
    };

    function Item_F_TypeName_Filter(treeId, parentNode, childNodes) {
        if (!childNodes) return null;
        for (var i = 0, l = childNodes.length; i < l; i++) {
            childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
        }
        return childNodes;
    }

    function Item_F_TypeName_OnClick(event, treeId, treeNode, clickFlag) {
        var zTree = $.fn.zTree.getZTreeObj("Item_TypeName_Div_Tree");
        zTree.checkNode(treeNode, !treeNode.checked, null, true);
        return false;
    }

    function Item_F_TypeName_OnCheck(e, treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj("Item_TypeName_Div_Tree");

        nodes = zTree.getCheckedNodes(true),

        v = "";
        name = "";
        for (var i = 0, l = nodes.length; i < l; i++) {
            v += nodes[i].id;
            name += nodes[i].name;
        }

        $("#Item_F_TypeId").attr("value", v);
        $("#Item_F_TypeName").attr("value", name);
    }

    function Item_F_TypeName_ShowMenu() {
        var cityObj = $("#Item_F_TypeName");
        var cityOffset = $("#Item_F_TypeName").offset();
        $("#Item_F_TypeName_Div").css({ left: "150px", top: "120px" }).slideDown("fast");
        $("body").bind("mousedown", Item_F_TypeName_OnBodyDown);
    }


    function Item_F_TypeName_OnBodyDown(event) {

        if (!(
            event.target.id == "Item_F_TypeId"
            || event.target.id == "Item_F_TypeName_Div"
            || $(event.target).parents("#Item_F_TypeName_Div").length > 0
            )) {

            $("#Item_F_TypeName_Div").fadeOut("fast");
            $("body").unbind("mousedown", Item_F_TypeName_OnBodyDown);
        }
    }

    $(function () {
        //$.fn.zTree.init($("#Item_TypeName_Div_Tree"), Item_F_TypeName_Setting);
    })

</script>

@*相关类别多选下拉树*@
<script type="text/javascript" language="javascript">

    var Item_F_TypeNames_Setting = {
        check: {
            enable: true,
            chkboxType: { "Y": "", "N": "" }
        },
        view: {
            dblClickExpand: false
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            onClick: Item_F_TypeNames_OnClick,
            onCheck: Item_F_TypeNames_OnCheck
        }
        ,
        async: {
            enable: true,
            url: "/Manage/CmsType/Action_GetType",
            autoParam: ["id"],
            otherParam: { "typeid": Item_TypeId },
            dataFilter: Item_F_TypeNames_Filter
        }
        , showLine: true,
    };

    function Item_F_TypeNames_Filter(treeId, parentNode, childNodes) {
        if (!childNodes) return null;
        for (var i = 0, l = childNodes.length; i < l; i++) {
            childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
        }
        return childNodes;
    }

    function Item_F_TypeNames_OnClick(event, treeId, treeNode, clickFlag) {
        var zTree = $.fn.zTree.getZTreeObj("Item_TypeNames_Div_Tree");
        zTree.checkNode(treeNode, !treeNode.checked, null, true);
        return false;
    }

    function Item_F_TypeNames_OnCheck(e, treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj("Item_TypeNames_Div_Tree");

        nodes = zTree.getCheckedNodes(true),

        v = "";
        name = "";
        for (var i = 0, l = nodes.length; i < l; i++) {
            v += nodes[i].id + ',';
            name += nodes[i].name + ',';
        }

        $("#Item_F_TypeIds").attr("value", v);
        $("#Item_F_TypeNames").attr("value", name);
    }

    function Item_F_TypeNames_ShowMenu() {
        $("#Item_F_TypeNames_Div").css({ left: "150px", top: "146px" }).slideDown("fast");
        $("body").bind("mousedown", Item_F_TypeNames_OnBodyDown);
    }

    function Item_F_TypeNames_OnBodyDown(event) {

        if (!(
            event.target.id == "Item_F_TypeIds"
            || event.target.id == "Item_F_TypeNames_Div"
            || $(event.target).parents("#Item_F_TypeNames_Div").length > 0
            )) {

            $("#Item_F_TypeNames_Div").fadeOut("fast");
            $("body").unbind("mousedown", Item_F_TypeNames_OnBodyDown);

        }

    }

    $(function () {
        //$.fn.zTree.init($("#Item_TypeNames_Div_Tree"), Item_F_TypeNames_Setting);
    })

</script>