

$(function(){
  $("a[href*='#']").click(function() {
  	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
  		var target = $(this.hash);
  		target = target.length && target || $('[id=' + this.hash.slice(1) + ']');
  		if (target.length) {
  			var targetOffset = target.offset().top;
  			$('html,body').animate({scrollTop: targetOffset}, 1000);
  			location.hash = this.hash;
  			return false;
  		}
  	}
  });
  
  $('#navigation li').each(function(i) {
     $(this).css('z-index', 1000 - (i * 2)).
      children('.navigationCaption').
      css('z-index',1000 - ((i * 2) - 1));
    });
  
  
  $('#navigation li').mouseover(
    function() {
      $(this).children('.navigationCaption').
        removeClass('navigationCaption').
        addClass('caption').
        css({
          'top': 0,
          'left': (($(this).children('a').width() + 6) + 'px') 
        });
    }).mouseout(
    function() {
      $(this).children('.caption').
        removeClass('caption').
        addClass('navigationCaption')
    });
});