$(document).ready(function() {

// Page Scroll
	var scrollSettings = {
		easing: "easeOutExpo",
		duration: "400",
		hash: "true"
	};
	
	$.localScroll(scrollSettings);
	$.localScroll.hash(scrollSettings);


// TopBar menu slider
	$(".menu ul li a").css({borderWidth : '0px', paddingLeft : '0px'});
			
	$(".menu ul li a").hover(
		function() {
			var li = $(this).parent();
			var newDist = 0;
			var newWidth = li.width();
			var bg, height, top;
			if(li.attr('id')) {bg = li.attr('id'); height = "40px"; top = "-35px"} else {bg = "#FFF",  height = "3px"; top = "5px"};
			li.prevAll().each(function() {
				newDist += $(this).outerWidth(true);
			});			
				
			$("#selector").stop(true).animate({left : newDist, width : newWidth, height : height, top : top, backgroundColor : bg}, 275);
		},
		function() {
			// Insert opacity animation to create delay effect (opacity is irrelevant, this is arbitrary and can be anything that
				// does not visibly change the bar
			$("#selector").animate({opacity : '1'}, 250, function() {
				// Here is what we want to happen after the delay
				$("#selector").animate({left : "0", width : "0", height : "3px", top : "5px", backgroundColor : "#FFF"}, 200);				
			});
		}
	);
	
// Portfolio images  

	$("ul.port li a").css({backgroundPosition : "0px 0px"})
  .hover(
		function() {
			$(this).stop().animate({backgroundPosition: "0 190px"}, "slow", "easeOutBounce");
		},
		function() {
			$(this).stop().animate({backgroundPosition: "0 0"}, "normal"); 
		});
		
// Hide construction worker

	$("#construction").animate({bottom: "-330px"}, 2000)
		.animate({bottom: "0"}, 2000)
		.animate({bottom: "0"}, 3000)
		.animate({bottom: "-330px"}, 1000)
		.hover(function() {
			$(this).stop().animate({bottom: "0"}, 500);
		}, function() {
			$(this).stop().animate({bottom: "-330px"}, 500);
		});

});