
    
jQuery(window).ready(function(){});

function elSlider(id,elpos,elautoplay,elspeed,elstep,eleasing,elstart,elevent) {

	if ( elautoplay > 0 ) { var elhover = '#elslider-'+id+'';	}
	else { var elhover = false; }
	
	var prevItem = '#elslider-'+id+'-navitem-'+elstart;
	var sliderClass = 'elslider-'+elpos+'-navigation-selected';
	var sliderInit = true;
	var item = '';
	
	jQuery(prevItem).addClass('elslider-h-navigation-selected');
   
	jQuery('#elslider-'+id).serialScroll({
		target:'.elslider-'+elpos+'-sections',
		items:'.elslider-'+elpos+'-scrollit', // Selector to the items ( relative to the matched elements, '#sections' in this case )
		prev:'a.elslider-prev-'+elpos+'',// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
		next:'a.elslider-next-'+elpos+'',// Selector to the 'next' button (absolute too)
		axis:'xy',// The default is 'y' scroll on both ways
		navigation:'.elslider-'+elpos+'-navigation li a',
		duration:elspeed,// 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)
		
		event:'click', // on which event to react.
		start:elstart, // first element (zero-based index)
		step:elstep, // how many elements to scroll on each action
		lock:true,// ignore events if already animating
		cycle:true, // cycle endlessly ( constant velocity )
		constant:true, // use contant speed ?
		interval:elautoplay, // it's the number of milliseconds to automatically go to the next
		// enlimbo
		stop_hover:elhover,
		/*
		navigation:null,// if specified, it's a selector a collection of items to navigate the container
		target:window, // if specified, it's a selector to the element to be scrolled.
		lazy:false,// go find the elements each time (allows AJAX or JS content, or reordering)
		stop:false, // stop any previous animations to avoid queueing
		force:false,// force the scroll to the first element on start ?
		jump: false,// if true, when the event is triggered on an element, the pane scrolls to it
		items:null, // selector to the items (relative to the matched elements)
		prev:null, // selector to the 'prev' button
		next:null, // selector to the 'next' button
		onBefore: function(){}, // function called before scrolling, if it returns false, the event is ignored
		exclude:0 // exclude the last x elements, so we cannot scroll past the end
		*/
		
		onBefore:function( e, elem, $pane, $items, pos ){
			
			item = '#elslider-'+id+'-navitem-'+pos;
			jQuery(prevItem).removeClass(sliderClass);
			jQuery(item).addClass(sliderClass);
			prevItem = item;
			
			/**
			 * 'this' is the triggered element 
			 * e is the event object
			 * elem is the element we'll be scrolling to
			 * $pane is the element being scrolled
			 * $items is the items collection at this moment
			 * pos is the position of elem in the collection
			 * if it returns false, the event will be ignored
			 */
			 //those arguments with a $ are jqueryfied, elem isn't.
			e.preventDefault();
			if( this.blur )
				this.blur();
		},
		onAfter:function( elem ){
			//if (sliderInit) { sliderInit = false; return; }
							
			/*jQuery(item).addClass(sliderClass);
			prevItem = item;*/

			//'this' is the element being scrolled ($pane) not jqueryfied
		}
	});
}