$(document).ready(function(){


	

	
	//INITIALIZE ACCORDION
	$('#container').accordion({
		autoHeight: false,
		navigation: true,
		collapsible: false,
		header: '.marker'
	});
	


	
	
	
	
	

	
	
	
	$.address.change(function(event) {  //If shit goes haywire, comment out this entire address change function to return to normal accordion functioning.
		var thePage=$('[rel=address:' + event.value + ']').attr('id');
		var target='#'+thePage+'_body div.target';
		var loading='#'+thePage+'_body div.loading';
		
		
		$(loading).html('<img src="img/spinning-star_'+thePage+'.gif" /><br />Loading').show();
		$(target).hide();
		var t=setTimeout(loadStuff,500);
		
		
		
		function loadStuff(){			
			$('#container').accordion('activate', '#'+thePage);
			$(target).load('inc/'+thePage+'.php', function(){
				$(loading).fadeOut(500, function(){
					$(target).toggle('blind');
				});
			});	
		}
		
		
		
		
	});
	
	







	
});
