/*
$('#focus').slider({delay:3000,focusClass:'up'});
*/

(function($) {
    $.fn.slider = function(options) {
	var settings = $.extend({delay:3000,focusClass:'focus'}, options);

	var current = 0;
	var pictures = $('.pictures a', this);
	var links = $('.links a', this);
	
	pictures.each(function(){$(this).hide();});

	run = function() {
		pictures.eq(current).hide();
		links.eq(current).removeClass(settings.focusClass);

		current++;
		if(current==pictures.length) current=0;

		pictures.eq(current).show();
		links.eq(current).addClass(settings.focusClass);

		setTimeout(function(){this.run();}, settings.delay);
	};

	pictures.eq(current).show();
	links.eq(current).addClass(settings.focusClass);

	setTimeout(function(){this.run();}, settings.delay);
    };
})(jQuery);

