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.
	 */
	
	/**
	 * Restart the scroll position to ( 0, 0 ) (Firefox doesn't reset it)
	 * could use $(target).scrollTo( 0, {axis:'xy'));
	 * but this needs to be quick(synchronous), to reset before $.localScroll.hash() begins
	 */
		
	$('.primaryContent').attr({scrollTop:0,scrollLeft:0});
		
 var $last = $([]);//save the last link
	
	$("a").filter(function(index){return $(this).attr("id")!= null && $(this).attr("id").indexOf("link") > -1}).click(function(){linkClick($(this).attr("id"))});
	
	/**
	 * 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: '.primaryContent', //could be a selector or a jQuery object too.
		axis:'yx', //the default is 'y'
		queue:true,
		duration:3000,
		hash:jQuery.browser.safari,
		onBefore:function( e, anchor, $target ){//'this' is the clicked link
			$last.removeClass('scrolling');
			$last = $(this).addClass('scrolling');
			//if( this.blur )
				this.blur();//remove the awful outline
		},
		onAfter:function( anchor ){
			$last.removeClass('scrolling');
			
			// hard coded checking for home link click			
			if($last.attr("href").indexOf("#Biomedical-Campus") > -1)
				linkClick("link5");
				
			}
	});
});

