// JavaScript Document

/**
	 * IMPORTANT: this call to the plugin specifies ALL the settings (plus some of jQuery.ScrollTo)
	 * This is done so you can see them. You DON'T need to specify the commented ones.
	 * A 'target' is specified, that means that #screen is the context for target, prev, next and navigation.
	 */
jQuery(function( $ ){
	
	var $nav = $('#paging li a');
	$nav.eq(0).addClass('current-link');
	var myStep = 4; //same as step passed to serialScroll
	
	$('#carousel-container').serialScroll({
		target:'#divResults',
		items:'li', // Selector to the items ( relative to the matched elements, '#sections' in this case )
		prev:'div.previous_button',// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
		next:'div.next_button',// Selector to the 'next' button (absolute too)
		axis:'xy',// The default is 'y' scroll on both ways
		duration:700,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
		force:true, // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
		exclude:3,
		step:4, // How many items to scroll each time ( 1 is the default, no need to specify )
		jump:false, // If true, items become clickable (or w/e 'event' is, and when activated, the pane scrolls to them)
		navigation:$nav,
		onBefore:function( e, elem, $pane, $items, pos ){
			//Advance the 1/2/3 button nav when using prev/next buttons
			var navPosition = pos/myStep;

			$nav.removeClass('current-link');
			$nav.eq(navPosition).addClass('current-link');
				
			}
		
		}); //end serial scroll init
	
			
	}	
)


$(document).ready(function () {

 // handle nav selection
    function selectNav() {
        $(this)
            .parents('ul:first')
                .find('a')
                    .removeClass('current-link')
                .end()
            .end()
            .addClass('current-link');
    }

    $('#paging').find('a').click(selectNav);
							});
