$(document).ready(function() {

	// Find the divs 
	
	$('#nav').each(function() {
		var $links = $(this).find('a'),
			panelIds = $links.map(function() { return this.hash; }).get().join(","),
			$panels = $(panelIds),
			$panelWrapper = $panels.filter(':first').parent(),
			delay = 500;
			
		$panels.hide();

		$links.click(function() {
			var $link = $(this),
				link = (this);
				
			if ($link.is('.current')) {
				return;
			}
		
		function selectNav() {
       $(this)
            .parents('ul:first')
                .find('li')
                    .removeClass('current')
                .end()
            .end()
            .addClass('current');
    }

    $('#navigation').find('li').click(selectNav);

			
			$panels.animate({ opacity : 0 }, delay);
			$panelWrapper.animate({
				height: 0
			}, delay, function() {
				var height = $panels.hide().filter(link.hash).show().css('opacity', 1).outerHeight();
							
				$panelWrapper.animate({
					height: height
				}, delay);
			});	
		});
		
		var showtab = window.location.hash ? '[hash=' + window.location.hash + ']' : ':first';
		
		$links.filter(showtab).click();
	
	});
	


	// Social

$('#social a').hover(function () {
		$('img', this).stop().animate({
'marginLeft' : 5
	}, 250);
}, function() {
		$('img', this).stop().animate({
'marginLeft' : 10
	}, 250);
});

});


