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.
	 */

	$.localScroll.defaults.axis = 'yx';
	
	// Scroll initially if there's a hash (#something) in the url 
	$.localScroll.hash({
            target: '#content', // Could be a selector or a jQuery object too.
            queue:true,
            duration:1000
	});

	//$localScroll.scroll( 0, location, settings );
	/**
	 * 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: '#content', // could be a selector or a jQuery object too.
		queue:true,
		duration:1000,
		hash:true,
		onBefore:function( e, anchor, $target ){
                    var w = (typeof window.innerWidth != 'undefined' ? window.innerWidth : document.body.offsetWidth);
                    var xoffset=Math.round((w-1519)/2);
                    //alert (xoffset);
			//this.offset=-xoffset;
                    this.offset={top:0, left:-xoffset}
                    $("#nav0").children('img').attr('src', "images/brodzik/normal0.png");
                    $("#nav1").children('img').attr('src', "images/brodzik/normal1.png");
                    $("#nav2").children('img').attr('src', "images/brodzik/normal2.png");
                    $("#nav3").children('img').attr('src', "images/brodzik/normal3.png");
                    $("#nav4").children('img').attr('src', "images/brodzik/normal4.png");
                    $("#nav5").children('img').attr('src', "images/brodzik/normal5.png");
                    $("#nav6").children('img').attr('src', "images/brodzik/normal6.png");
                    $("#nav7").children('img').attr('src', "images/brodzik/normal7.png");
                    $("#nav8").children('img').attr('src', "images/brodzik/normal8.png");
                   
		},
		onAfter:function( anchor, settings ){
                    $("#nav"+location.hash.substr(2,1)).children('img').attr("src", "images/brodzik/active"+location.hash.substr(2,1)+".png");
		}
	});
/*
        var $paneTarget = $('#pane-target');

	$('#relative-selector').click(function(){
		$paneTarget.stop().scrollTo( 'li:eq(14)', 800 );
	});
*/

        
	



});
