$(document).ready(function()
{
	var tabs = $('#tabs');
	if ($.browser.msie && $.browser.version < '7.0')
	{
		$('div:first > div:first',tabs).css('margin-left','0');
		$('img').each(function()
		{
			var regex = /.png$/i;
			var src = $(this).attr('src');
			$(this).attr('src', src.replace(regex, '.gif'));
		});
		$('#tree').css('height', '480px');
	}
	else
	{
		$('div:first',tabs).css('overflow','visible');
	}
	
	var id = null;
	var match = null;
	var regex = /^\/([^\/]+?)(\.html|\/)/i;
	if (location.pathname == '/')
	{
		id = 'index';
	}
	else if (match = regex.exec(location.pathname))
	{
		id = match[1];
	}
	if (id != null)
	{
		var tab = $('#'+id, tabs);
		tab.addClass('tab-active');
		$('a', tab).replaceWith($('a', tab).text());
		tabs = $('#tabs > div[id!='+id+']');
	}
	else
	{
		tabs = $('#tabs > div');
	}
	tabs.mouseover(function()
	{
		$(this).addClass('tab-hover');
	});
	
	tabs.mouseout(function()
	{
		$(this).removeClass('tab-hover');
	});
});
