$(document).ready(function(){
	
	$('#profile').hide();
	
	$(document).delegate('a.external','click',function(){return !window.open($(this).attr("href"))});
	
	$('#btn-profile').bind('click',function(){
		$('#profile').slideDown();
		moveViewportTo($('#profile'));
		return false;
	});
	
	$('#profile .btn-hide').bind('click',function(){
		$('#profile').slideUp();
		moveViewportTo($('body'));
		return false;
	});
	
	$('#signpost a').bind('mouseenter',function(event){		
		var $li=$(this);
		$li.stop(true,true).css({background: 'white'}).delay(20).queue(function(){
			$(this).css({background: 'black'})
		});
	});
	$('#signpost a').bind('mouseleave',function(){
		$(this).stop(true,true).removeAttr('style');
	});
			
});

function moveViewportTo($element){
	$('html,body').animate({
		scrollTop: $($element).offset().top
	}, 500);
	return false;
};
