$(document).ready(function(){

	// The default axis is 'y', but in this demo, I want to scroll both
	// You can modify any default like this
	$.localScroll.defaults.axis='x';
	
	// Scroll initially if there's a hash (#something) in the url 
	/*$.localScroll.hash({
		target: '#scrollable', // 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.
	 */

	$('.scrollablelistnav').localScroll({
		target: '.scrollable', // could be a selector or a jQuery object too.
		queue:true,
		duration:1000,
		onBefore:function( e, anchor, $target ){
			// The 'this' is the settings object, can be modified
			$('.scrollablelistnav').css('display','none');
			$('#'+anchor.id+'nav').css('display','block');
		},
		onAfter:function( anchor, settings ){
			// The 'this' contains the scrolled element (#content)
		}
	});


});

function initFeatureList(intRowWidth,intGutterWidth){
	var intRowCount=$('.scrollable .row').length;

	if(intRowCount>1){

		$('.scrollable').css({
			'overflow':'hidden',
			'clear':'left',
			'float':'left',
			'width':intRowWidth+'px'
		});

		if(intGutterWidth>0){
			$('.scrollable .row').css('margin-right',intGutterWidth+'px');
		}

		var strPrevLink;
		var strNextLink;

		$('.scrollable .row').each(function(i){
			$(this).attr('id','row'+i);
			if((i-1)>-1){
				strPrevLink='<a href="#row'+(i-1)+'" class="prev">&laquo; Previous</a>';
			}else{
				strPrevLink='';
			}

			if((i+1)<intRowCount){
				strNextLink='<a href="#row'+(i+1)+'" class="next">Next &raquo;</a>';
			}else{
				strNextLink='';
			}
			$('.scrollable').after('<div id="row'+i+'nav" class="scrollablelistnav">'+strPrevLink+' '+strNextLink+'</div>');
		});
	
		$('.scrollable .row').css({
			'clear':'none',
			'width':intRowWidth+'px'
		});
	
		$('.scrollable .gallery').css('width',(intRowWidth*intRowCount)+(intGutterWidth*intRowCount));

	}
}

