Ext.onReady(function(){
    new Ext.Viewport({
        layout:"border",
        items:[{
            region:"north",
            html:"<h3 style='margin:15px 0 0 25px;color:#FFFFFF;'>游戏新手卡领号程序管理系统-蓝色动力网络</h3>",
            height:60,
			bodyStyle :"background: #99BBE8;"      
        },{
            region:"west",
            title:"菜单项",
            width:150,
            xtype:"treepanel",
            rootVisible:false,
            listeners:{
              click:function(node,e){
				if(node.attributes.clz=="index"||node.attributes.clz=="logout"){
					if(node.attributes.clz=="index"){
						window.open("../");
					}else{
						window.location="user.php?cmd=logout";
					}
				}else{
                  var url="js/"+node.attributes.clz+".js";
                  Ext.ensure({
                    js: [url],
                    callback: function() {
                        var other = eval("new "+node.attributes.clz+"()");
                         var main=Ext.getCmp("main");
                          if(main.items.getCount()>0)main.remove(0);
                          main.add(other);
                          main.doLayout();
                    },
                    scope: this
                });
				}
              }
            },
            root:new Ext.tree.AsyncTreeNode({
                text:"树根",
                children:[{
                    text:"网站首页",
                    clz:"index",
                    leaf:true
                },{
                    text:"游戏分类管理",
                    clz:"GameClassPanel",
                    leaf:true
                },{
                    text:"卡号管理",
                    clz:"CardPanel",
                    leaf:true
                },{
                    text:"新闻管理",
                    clz:"NewsInfoPanel",
                    leaf:true
                },{
                    text:"新闻分类管理",
                    clz:"NewsClassPanel",
                    leaf:true
                },{
                    text:"用户管理",
                    clz:"UserPanel",
                    leaf:true
                },{
                    text:"退出后台",
                    clz:"logout",
                    leaf:true
                }]
                })
        },{
            region:"center",
            title:"主区域",
            layout:"fit",
            id:"main",
			html:"<h2 style='margin:20px 0 0 50px'>欢迎使用本系统</h2>"
        }]
    })
});