//设置树的点击事件
function treeClick(node,e) {
	 if(node.isLeaf()){
		e.stopEvent();
		var n = tab.getComponent(node.id);
		if (!n) {
			var n = tab.add({
				'id' : node.id,
				'title' : node.text,
			    autoScroll:true,
				closable:true,
				 //autoLoad: {url: 'Code.aspx', params: 'id='+node.id+''}
				 html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="HTML/'+node.id+'.html"></iframe>'
				});
		}
		tab.setActiveTab(n);
	 }
}

function tree2Click(node,e)
 { 
 	var n = tab.getComponent(node.id);
if (!n) {
switch(node.id)
    {
 
	    case "c1" :
       {
         
		
			var n = tab.add({
				'id' : node.id,
				'title' : node.text,
			    autoScroll:true,
				closable:true,
				 //autoLoad: {url: 'Code.aspx', params: 'id='+node.id+''}
				 html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="Tools/MD5.aspx"></iframe>'
				});
		
				 break;
       }
	  
	   	    case "c2" :
       {
         
		
			var n = tab.add({
				'id' : node.id,
				'title' : node.text,
			    autoScroll:true,
				closable:true,
				 //autoLoad: {url: 'Code.aspx', params: 'id='+node.id+''}
				 html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="Tools/PE.aspx"></iframe>'
				});
		
				 break;
       }
	      	    case "c3" :
       {
         
		
			var n = tab.add({
				'id' : node.id,
				'title' : node.text,
			    autoScroll:true,
				closable:true,
				 //autoLoad: {url: 'Code.aspx', params: 'id='+node.id+''}
				 html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="Tools/IP.aspx"></iframe>'
				});
		
				 break;
       }
	         	    case "c4" :
       {
         
		
			var n = tab.add({
				'id' : node.id,
				'title' : node.text,
			    autoScroll:true,
				closable:true,
				 //autoLoad: {url: 'Code.aspx', params: 'id='+node.id+''}
				 html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="Tools/SF.aspx"></iframe>'
				});
		
				 break;
       }
	   	   	     case "c5" :
       {
         
		
			var n = tab.add({
				'id' : node.id,
				'title' : node.text,
			    autoScroll:true,
				closable:true,
				 //autoLoad: {url: 'Code.aspx', params: 'id='+node.id+''}
				 html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="Tools/Alexa.aspx"></iframe>'
				});
		
				 break;
       }

	   
	     case "c8" :
       {
         
		
			var n = tab.add({
				'id' : node.id,
				'title' : node.text,
			    autoScroll:true,
				closable:true,
				 //autoLoad: {url: 'Code.aspx', params: 'id='+node.id+''}
				 html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src=" http://asp99.net/zhantool/html_js.asp"></iframe>'
				});
		
				 break;
       }
	  
	   	    case "c9" :
       {
         
		
			var n = tab.add({
				'id' : node.id,
				'title' : node.text,
			    autoScroll:true,
				closable:true,
				 //autoLoad: {url: 'Code.aspx', params: 'id='+node.id+''}
				 html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="http://asp99.net/zhantool/+m.asp"></iframe>'
				});
		
				 break;
       }
	   	    case "c12" :
       {
         
		
			var n = tab.add({
				'id' : node.id,
				'title' : node.text,
			    autoScroll:true,
				closable:true,
				 //autoLoad: {url: 'Code.aspx', params: 'id='+node.id+''}
				 html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="http://asp99.net/zhantool/-m.asp"></iframe>'
				});
		
				 break;
       }
	    case "c10" :
       {
         
		
			var n = tab.add({
				'id' : node.id,
				'title' : node.text,
			    autoScroll:true,
				closable:true,
				 //autoLoad: {url: 'Code.aspx', params: 'id='+node.id+''}
				 html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="http://asp99.net/zhantool/Gb_Big.asp"></iframe>'
				});
		
				 break;
       }
	   case "c11" :
       {
         
		
			var n = tab.add({
				'id' : node.id,
				'title' : node.text,
			    autoScroll:true,
				closable:true,
				 //autoLoad: {url: 'Code.aspx', params: 'id='+node.id+''}
				 html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="http://asp99.net/zhantool/js_vb.asp"></iframe>'
				});
		
				 break;
       }
	   

     }
}

		tab.setActiveTab(n);
	
}
//生成标签页
var tab = new Ext.TabPanel({
			region:'center',
			deferredRender:false,
			activeTab:0,
			resizeTabs:true, // turn on tab resizing
			minTabWidth: 115,
			tabWidth:135,
			autoScroll:true,
			enableTabScroll:true,
            items:[{
             contentEl:'center2',
            title: '默认',
             html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="HTML/default.html"></iframe>',
            autoScroll:true
 }]
           
		});

Ext.onReady(function(){
   //layout
   var viewport = new Ext.Viewport({
		layout:'border',
		items:[
			new Ext.BoxComponent({
				region:'north',
				el: 'north',
				height:80
			}),new Ext.BoxComponent({
				region:'south',
				el: 'south',
				height:30
			}),{
			region:'west',
			id:'west-panel',
			split:true,
			width: 250,
			minSize: 175,
			maxSize: 400,
			margins:'0 0 0 0',
			layout:'accordion',
			title:'帮助菜单',
			collapsible :true,
			layoutConfig:{
				animate:true
				},
		    items: [
			    {
					title:'使用帮助',
					border:false,
					html:'<div id="tree-div" style="overflow:auto; overflow-y:auto;width:100%;height:100%"></div>'
					//iconCls:'nav'
			    },{
					title:'站长工具',
					border:false,
				
					//iconCls:'settings',
					html:'<div id="tree" style="overflow:auto;width:100%;height:100%"></div>'
			    }]
			},
	        tab//初始标签页
		 ]
	});

	//设置树形面板
	var Tree = Ext.tree;
	// set the root node
	var root = new Tree.AsyncTreeNode({
		text: 'Ext JS',
		draggable:false,
		id:'0'
	});

	var tree = new Tree.TreePanel({
		el:'tree-div',
		root:root,
		autoScroll:true,
		animate:true,
		enableDD:false,
		border:false,
		rootVisible:false,
		containerScroll: true,
		loader: new Tree.TreeLoader({
		dataUrl:'Tree.ashx'
		})
	});

    tree.setRootNode(root);
	// render the tree
	tree.render();
	root.expand();
	tree.on('click',treeClick);

    //tree2
    var root2=new Ext.tree.TreeNode({
		    id:"root2",
		    text:"树的根"
		});

	
  var c1=new Ext.tree.TreeNode({
		id:'c1',
		icon:'img/im2.gif',
		text:'MD5加密/解密'
	});

     var c2=new Ext.tree.TreeNode({
		id:'c2',
		icon:'img/im2.gif',
		text:'身份证查询'
	});

    var c3=new Ext.tree.TreeNode({
		id:'c3',
		icon:'img/im2.gif',
		text:'IP物理定位查询'
	});

    var c4=new Ext.tree.TreeNode({
		id:'c4',
		icon:'img/im2.gif',
		text:'手机号归地查询'
	});
	  var c5=new Ext.tree.TreeNode({
		id:'c5',
		icon:'img/im2.gif',
		text:'ALEXA排名查询'
	});


	  var c8=new Ext.tree.TreeNode({
		id:'c8',
		icon:'img/im2.gif',
		text:'HTML/JS互转工具'
	});
	  var c9=new Ext.tree.TreeNode({
		id:'c9',
		icon:'img/im2.gif',
		text:'ESCAPE加密'
	});
	  var c10=new Ext.tree.TreeNode({
		id:'c10',
		icon:'img/im2.gif',
		text:'GB2312/BIG5互转'
	});
  var c11=new Ext.tree.TreeNode({
		id:'c11',
		icon:'img/im2.gif',
		text:'网页代码JS/VB加密'
        
        
	});
	  var c12=new Ext.tree.TreeNode({
		id:'c12',
		icon:'img/im2.gif',
		text:'ESCAPE解密'
        
        
	});


	root2.appendChild(c1);
    root2.appendChild(c2);
    root2.appendChild(c3);
    root2.appendChild(c4);
    root2.appendChild(c5);
   
   
    root2.appendChild(c8);
    root2.appendChild(c9);
     root2.appendChild(c12);
    root2.appendChild(c10);
    root2.appendChild(c11);
	var tree2=new Ext.tree.TreePanel({
		renderTo:"tree",
		autoScroll:true,
		root:root2,
		animate:true,
		enableDD:false,
		border:false,
		rootVisible:false,
		containerScroll: true
	});
   tree2.on('click',tree2Click);



	//end loding
	setTimeout(
				function() {
					Ext.get('loading').remove();
					Ext.get('loading-mask').fadeOut({remove:true});
				}, 250
			  );
});
