$(document).ready(function(){

	$('#journey').hover(function(){
		if( $.browser.msie ){
			$('#journey span').show();
		} else {
			$('#journey span').fadeIn('fast');
		}
	},function(){
		if( $.browser.msie ){
			$('#journey span').hide();
		} else {
			$('#journey span').fadeOut('fast');
		}
	});
	
	
	// Show or hide navigation labels
	function toggleNav() {
		if ( $('.label').is(':hidden') ) {
			$('#label-right').show().animate({ width: 250 }, 500);
			$('#label-left').show().animate({ width: 250, left: 15}, 500);
		} else {
			$('#label-right').animate({ width: 0 }, 200, function(){
				$(this).hide();
			});
			$('#label-left').animate({ left: 265, width: 0 }, 200).animate({ left: 15}, 500, function(){
				$(this).hide();
			});
		}
	}
	
	function navigate(id){
		toggleNav();
		$(this).delay(500, function(){
			location = '/full-life/'+id+'/';
		});
	}
	
	function nextJourney(id){
		toggleNav();
		$(this).delay(500, function(){
			location = '?site='+id;
		});
	}
	
	$('#label-left a, #label-right a').click(function(){
		navigate( $(this).attr('rel') );
		return false;
	});
	
	$('#journey').click(function(){
		nextJourney( $(this).attr('rel') );
		return false;
	});
	
	$(window).load(function(){
		toggleNav();
	});
	
});

