Ext.onReady(function(){

    if (Ext.get('tabs') != undefined) {	
    var tabs = new Ext.TabPanel({
		applyTo: 'tabs',
		deferredRender: false,
		autoTabs: true,
		plain: true,
		resizeTabs: true,
		activeTab: 0,
		bodyStyle: 'padding: 20px 20px 20px 20px',
/*		height: 300,*/
		defaults:{ autoScroll: true },
		listeners: {
			beforetabchange: function(tabpanel, newtab, currenttab) {
				if (currenttab != undefined) {
					var url = document.location.href.split('#');
				  	document.location.href = url[0] + '#'+newtab.title;					
				}
			}
		}
    });

	var uri = document.location.toString();
	for (var item in tabs.items.items) {
		if (uri.match("#"+tabs.items.items[item].title))
		{
			tabs.setActiveTab(tabs.items.items[item].id);
		}
	}
	
     }
});
