$(function() {
	// Open link in new window
	$(".external").attr("target","_blank");
	
	// Place a vintage border on top of the slider on the home page
	$("#slider").prepend("<img src='images/globals/work_overlay.png' alt='Overlay' class='overlay_slider' />");
	
	// Toggle hidden elements
	$("div.hidden_element").hide()
	$("a.bullet").click(function() {
		$("div.hidden_element").slideToggle("slow");
	});
	
	// Animate menu
	$('.main_nav a')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -52px)"}, {duration:300})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:300, complete:function(){
				$(this).css({backgroundPosition: "0px 0px"})
			}})
		})

				
	// Set the scroll to anchor
	anchor.init()
	
});

anchor = {
	init : function()  {
		$("a.anchorLink").click(function () {	
			elementClick = $(this).attr("href")
			destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100 );
		  	return false;
		})
	}
}
