$(function () {            
    var Menu = [
        {
            "addtab": "",
            "target": "",
            "title": "布局",
            "url": "",
            "icon": "fa-columns",
            "nav": "layouts",
            "children": [
                {
                    "addtab": "grid",
                    "target": "#MasterTabs",
                    "title": "栅格",
                    "url": "pages/layouts/grid.html",
                    "icon": "",
                    "nav": "layouts",
                    "children":[]
                },
                {
                    "addtab": "layout",
                    "target": "#MasterTabs",
                    "title": "后台布局",
                    "url": "pages/layouts/layout.html",
                    "icon": "",
                    "nav": "layouts",
                    "children":[]
                }
            ]
        }, {
            "addtab": "",
            "target": "",
            "title": "基本元素",
            "url": "",
            "icon": "fa-fonticons",
            "nav": "ui",
            "children": [
                {
                    "addtab": "buttons",
                    "target": "#MasterTabs",
                    "title": "按钮",
                    "url": "pages/ui/buttons.html",
                    "icon": "",
                    "nav": "ui",
                    "children":[]
                },
                {
                    "addtab": "forms",
                    "target": "#MasterTabs",
                    "title": "表单",
                    "url": "pages/ui/forms.html",
                    "icon": "",
                    "nav": "ui",
                    "children":[]
                },
                {
                    "addtab": "tabs",
                    "target": "#MasterTabs",
                    "title": "选项卡",
                    "url": "pages/ui/tabs.html",
                    "icon": "",
                    "nav": "ui",
                    "children":[]
                },
                {
                    "addtab": "progress",
                    "target": "#MasterTabs",
                    "title": "进度条",
                    "url": "pages/ui/progress.html",
                    "icon": "",
                    "nav": "ui",
                    "children":[]
                },
                {
                    "addtab": "panel",
                    "target": "#MasterTabs",
                    "title": "面板",
                    "url": "pages/ui/panel.html",
                    "icon": "",
                    "nav": "ui",
                    "children":[]
                },
                {
                    "addtab": "icons",
                    "target": "#MasterTabs",
                    "title": "图标",
                    "url": "pages/ui/icons.html",
                    "icon": "",
                    "nav": "ui",
                    "children":[]
                },
                {
                    "addtab": "timeline",
                    "target": "#MasterTabs",
                    "title": "时间线",
                    "url": "pages/ui/timeline.html",
                    "icon": "",
                    "nav": "ui",
                    "children":[]
                },
                {
                    "addtab": "table",
                    "target": "#MasterTabs",
                    "title": "静态表格",
                    "url": "pages/ui/table.html",
                    "icon": "",
                    "nav": "ui",
                    "children":[]
                },
                {
                    "addtab": "auxiliar",
                    "target": "#MasterTabs",
                    "title": "辅助元素",
                    "url": "pages/ui/auxiliar.html",
                    "icon": "",
                    "nav": "ui",
                    "children":[]
                }
            ]
        }, {
            "addtab": "",
            "target": "",
            "title": "组件",
            "url": "",
            "icon": "fa-laptop",
            "nav": "assembly",
            "children": [
                {
                    "addtab": "navtab",
                    "target": "#MasterTabs",
                    "title": "导航条",
                    "url": "pages/assembly/navtab.html",
                    "icon": "",
                    "nav": "assembly",
                    "children":[]
                },
                {
                    "addtab": "message",
                    "target": "#MasterTabs",
                    "title": "信息提示",
                    "url": "pages/assembly/message.html",
                    "icon": "",
                    "nav": "assembly",
                    "children":[]
                },
                {
                    "addtab": "fyAlert",
                    "target": "#MasterTabs",
                    "title": "信息提示2",
                    "url": "pages/assembly/fyAlert.html",
                    "icon": "",
                    "nav": "assembly",
                    "children":[]
                },
                {
                    "addtab": "data",
                    "target": "#MasterTabs",
                    "title": "bootstrap-table表格",
                    "url": "pages/assembly/data.html",
                    "icon": "",
                    "nav": "assembly",
                    "children":[]
                },
                {
                    "addtab": "jqgrid",
                    "target": "#MasterTabs",
                    "title": "jQgrid表格",
                    "url": "pages/assembly/jqgrid.html",
                    "icon": "",
                    "nav": "assembly",
                    "children":[]
                },
                {
                    "addtab": "carousel",
                    "target": "#MasterTabs",
                    "title": "轮播",
                    "url": "pages/assembly/carousel.html",
                    "icon": "",
                    "nav": "assembly",
                    "children":[]
                },
                {
                    "addtab": "tree",
                    "target": "#MasterTabs",
                    "title": "树组件",
                    "url": "pages/assembly/tree.html",
                    "icon": "",
                    "nav": "assembly",
                    "children":[]
                },
                {
                    "addtab": "video",
                    "target": "#MasterTabs",
                    "title": "播放器",
                    "url": "pages/assembly/video.html",
                    "icon": "",
                    "nav": "assembly",
                    "children":[]
                },
                {
                    "addtab": "menu",
                    "target": "#MasterTabs",
                    "title": "JSON菜单",
                    "url": "pages/assembly/menu.html",
                    "icon": "",
                    "isUrl": true,
                    "children":[]
                }
            ]
        }, {
            "addtab": "",
            "target": "",
            "title": "页面",
            "url": "",
            "icon": "fa-folder",
            "nav": "page",
            "children": [{
                    "addtab": "invoice",
                    "target": "#MasterTabs",
                    "title": "单据",
                    "url": "pages/page/invoice.html",
                    "icon": "",
                    "nav": "page",
                    "children":[]
                },
                {
                    "addtab": "profile",
                    "target": "#MasterTabs",
                    "title": "个人简介",
                    "url": "pages/page/profile.html",
                    "icon": "",
                    "nav": "page",
                    "children":[]
                },
                {
                    "addtab": "",
                    "target": "",
                    "title": "登录页",
                    "url": "pages/page/login.html",
                    "icon": "",
                    "isUrl": true,
                    "children":[]
                },
                {
                    "addtab": "",
                    "target": "",
                    "title": "注册页",
                    "url": "pages/page/register.html",
                    "icon": "",
                    "isUrl": true,
                    "children":[]
                },
                {
                    "addtab": "",
                    "target": "",
                    "title": "空白页",
                    "url": "blank.html",
                    "icon": "",
                    "isUrl": true,
                    "children":[]
                },
                {
                    "addtab": "404",
                    "target": "#MasterTabs",
                    "title": "404 Error",
                    "url": "pages/page/404.html",
                    "icon": "",
                    "nav": "page",
                    "isUrl": false,
                    "children":[]
                },
                {
                    "addtab": "500",
                    "target": "#MasterTabs",
                    "title": "500 Error",
                    "url": "pages/page/500.html",
                    "icon": "",
                    "nav": "page",
                    "isUrl": false,
                    "children":[]
                }
            ]
        },
        {
            "addtab": "",
            "target": "",
            "title": "AJAX示例",
            "url": "",
            "icon": "fa-magnet",
            "nav": "ajaxs",
            "children":[
                    {
                    "addtab": "ajaxdemo",
                    "target": "#MasterTabs",
                    "title": "AJAX加载Viewer组件",
                    "url": "pages/ajaxs/views.html",
                    "icon": "",
                    "nav": "ajaxs",
                    "ajax":true,
                    "children":[]
                }
            ]
        },
        {
            "addtab": "test1",
            "target": "#MasterTabs",
            "title": "百度",
            "url": "http://wwww.baidu.com",
            "icon": "",
            "nav": "test1",
            "isUrl": true,
            "children":[]
        },
        {
            "addtab": "test16",
            "target": "#MasterTabs",
            "title": "多级菜单",
            "url": "pages/assembly/test.html",
            "icon": "",
            "nav": "test16",
            "children":[
                {
                    "addtab": "test17",
                    "target": "#MasterTabs",
                    "title": "一级-1",
                    "url": "http://www.baidu.com",
                    "icon": "",
                    "nav": "test16",
                    "isUrl": true,
                    "children":[]
                },
                {
                    "addtab": "test18",
                    "target": "#MasterTabs",
                    "title": "一级-2",
                    "url": "pages/assembly/test.html",
                    "icon": "",
                    "nav": "test16",
                    "children":[
                        {
                            "addtab": "test19",
                            "target": "#MasterTabs",
                            "title": "二级-1",
                            "url": "pages/assembly/test.html",
                            "icon": "",
                            "nav": "test16",
                            "children":[]
                        },
                        {
                            "addtab": "test20",
                            "target": "#MasterTabs",
                            "title": "二级-2",
                            "url": "pages/assembly/test.html",
                            "icon": "",
                            "nav": "test16",
                            "children":[
                                {
                                    "addtab": "test21",
                                    "target": "#MasterTabs",
                                    "title": "三级-1",
                                    "url": "pages/assembly/test.html",
                                    "icon": "",
                                    "nav": "test16",
                                    "children":[]
                                },
                                {
                                    "addtab": "test22",
                                    "target": "#MasterTabs",
                                    "title": "三级-2",
                                    "url": "pages/assembly/test.html",
                                    "icon": "",
                                    "nav": "test16",
                                    "children":[]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ];
     //$.LanaiMenu(Menu, { EnableNav: true })
     $.LanaiMenu(Menu, { EnableNav: $('[data-enableNav="toggle"]:checked').length > 0 })

    $('[data-enableNav="toggle"]').change(function () {
        $.LanaiMenu(Menu, { EnableNav: $('[data-enableNav="toggle"]:checked').length > 0 })
    })
})