(function($){
	
	$.fn.slides = function(options, before, after) {
		
		var settings, current, nonCurrent, before, after;
		
		var defaults = {
			speed					: 500,
			easing					: 'swing',
			auto					: false,
			interval				: 6000,
			triggers				: '#navigation .nav ul > li',
			defaultState			: {}, // CSS
			currentState			: {}, // CSS
			nonCurrentState			: {}, // CSS
			currentTransition		: {}, // Animation
			nonCurrentTransition	: {}, // Animation
			before					: {},
			after					: {}
		};
		
		settings = $.extend(true, {}, defaults, options);
		
		// Set current and non current states (initial)
		makeCurrent($(this).filter(':first-child'));
		makeNonCurrent($(this).filter(':not(:first-child)'));
		
		// Set to current
		function makeCurrent($object) {
			before.call(this);
			current = $object.data('current', true).stop().animate(settings.currentTransition, settings.speed, settings.easing, function() {
					$object.css($.extend({}, settings.defaultState, settings.currentState));
					after.call(this);
				});
		}
		
		// Set to non current state
		function makeNonCurrent($object) {
			nonCurrent = $object.data('current', false).stop().animate(settings.nonCurrentTransition, settings.speed, settings.easing, function() {
					$object.css($.extend({}, settings.defaultState, settings.nonCurrentState));
				});
		}
		
		// Switch to slide
		function toSlide($object) {
			makeNonCurrent(current);
			makeCurrent($object);
		}
		
		// Switch to next slide
		function next() {
			
		}
		
		// Switch to previous slide
		function previous() {
			
		}
		
		if($.fn.hoverIntent) {
			$(settings.triggers).hoverIntent(function() {
				proposedSlide = $(this).data('slide');
				
				if(proposedSlide && $(proposedSlide)[0] !== current[0]) {
					toSlide($($(this).data('slide')));
				}
			}, function() {});
		} else {
			$(settings.triggers).hover(function() {
				proposedSlide = $(this).data('slide');
				
				if(proposedSlide && $(proposedSlide)[0] !== current[0]) {
					toSlide($($(this).data('slide')));
				}
			});
		}
		
		// Automatic "next"
		if(settings.auto) {
			window.setInterval(settings.interval, next);
		}
	}
	
})(jQuery);
