

	$(document).ready(function()
	{
		//decoratePage();
		$('#topbar').bind( 'click', function(){ window.location = root + "/page/fanpage"; } );
	});
	
	
	function decoratePage()
	{
		// replace the tab links with tab actions
		$('#tabs div').each( function(){ decorateTab( this.id ); } );
	}
	
	function decorateTab( id )
	{
		var link = $('#' + id + ' a');
		
		// out with boring old href
		link.removeAttr( 'href' );
		
		// in with the onclick
		link.bind( 'click', function(){ selectTab( id ); } );
	} 
	
	function selectTab( id )
	{
		// unselect current tab
		$('#tabs .selected').removeClass( 'selected' );
		
		// select new tab
		$('#tabs #' + id ).addClass( 'selected' );
		
		// load the content
		$.get(	root + '/ajax.php',
				{ page: id },
				didSelectTab );
	}
	
	function didSelectTab( response )
	{
		$('#content').html( response );
	}