// JavaScript Document
var center_panel;
var index = 0;

function addTabToCenter(node, e){
	if(node.leaf){
		if(center_panel.getComponent(node.attributes.url)){
			center_panel.getComponent(node.attributes.url).show();
		}else{
			center_panel.add({
				id: node.attributes.url,
				title: node.parentNode.attributes.Name+'::'+node.attributes.Name,
				iconCls: 'tabs',
				html: 'Tab Body '+ node.href + node.leaf +node.attributes.url,
				closable:true,
				 autoLoad:node.attributes.url
			}).show();
		}
	}
}
function addTabToCenterByURL(url,title){	
		if(center_panel.getComponent(url)){
			center_panel.getComponent(url).show();
		}else{
			center_panel.add({
				id: url,
				title: title,
				iconCls: 'tabs',
				html: 'Tab Body ',
				scripts:true,
				closable:true,
				 autoLoad:url
			}).show();
		}
	
}
Ext.onReady(function(){
					center_panel  = new Ext.TabPanel({
                    region:'center',
					plugins: new Ext.ux.TabCloseMenu(),
                    deferredRender:false,					
                    activeTab:0,
					defaults: {autoScroll:true},        			
					enableTabScroll:true,
                    items:[{                        
                        title: 'Welcome',
                        autoScroll:true,
						autoLoad: {url: 'pages/welcome.php'}
                    }]
                });

});