jQuery(function( $ ){
	/**
	 * Most jQuery.localScroll's settings, actually belong to jQuery.ScrollTo, check it's demo for an example of each option.
	 * @see http://flesler.demos.com/jquery/scrollTo/
	 * You can use EVERY single setting of jQuery.ScrollTo, in the settings hash you send to jQuery.LocalScroll.
	 */
	
	// The default axis is 'y', but in this demo, I want to scroll both
	// You can modify any default like this
	$.localScroll.defaults.axis = 'y';
	
	// Scroll initially if there's a hash (#something) in the url 
	$.localScroll.hash({
		target: '#viewer', // Could be a selector or a jQuery object too.
		queue:true,
		duration:1500
	});
	
	/**
	 * NOTE: I use $.localScroll instead of $('#navigation').localScroll() so I
	 * also affect the >> and << links. I want every link in the page to scroll.
	 */
	$.localScroll({
		target: '#viewer', // could be a selector or a jQuery object too.
		queue:true,
		duration:1000,
		hash:false,
		onBefore:function( e, anchor, $target ){
			// The 'this' is the settings object, can be modified
		},
		onAfter:function( anchor, settings ){
			// The 'this' contains the scrolled element (#content)
		}
	});
	
});



$(document).ready(function(){
	// switch main navigaion images/page name text when user clicks
	$("a.home").click(function () { 
		$("h1#page-name").html("Home");
		$("#navigation a").removeClass("active");
		$("a.home").addClass("active");
	});
	$("a.about-us").click(function () { 
		$("h1#page-name").html("About Us");
		$("#navigation a").removeClass("active");
		$("a.about-us").addClass("active");
	});
	$("a.services").click(function () { 
		$("h1#page-name").html("Services");
		$("#navigation a").removeClass("active");
		$("a.services").addClass("active");
	});
	$("a.packages").click(function () { 
		$("h1#page-name").html("Packages");
		$("#navigation a").removeClass("active");
		$("a.packages").addClass("active");
	});
	$("a.gallery").click(function () { 
		$("h1#page-name").html("Gallery");
		$("#navigation a").removeClass("active");
		$("a.gallery").addClass("active");
	});
	$("a.contact").click(function () { 
		$("h1#page-name").html("Contact");
		$("#navigation a").removeClass("active");
		$("a.contact").addClass("active");
	});
	
	// switch other services information when clicked
	$("a.web-design").click(function () {
		$("#other-services-nav a").removeClass("active");
		$("a.web-design").addClass("active");
		$("#photography").addClass("invisible");
		$("#web-design").removeClass("invisible");
	});
	$("a.photography").click(function () {
		$("#other-services-nav a").removeClass("active");
		$("a.photography").addClass("active");
		$("#web-design").addClass("invisible");
		$("#photography").removeClass("invisible");
	});
	
	
	// Gallery Scroller
	$('a#gallery-next').click(function(){
		$('div.gallery').stop().scrollTo( '+=200', '+=200' );
	});
	$('a#gallery-prev').click(function(){
		$('div.gallery').stop().scrollTo( '-=200', '-=200' );
	});
	
	// Remove outlines from clicked links
	$("a").click(function() {
		$(this).blur();
	});
	
	// Open external links in new tab
	$("a.external").attr({ target: "_blank" });

});