jQuery.fn.slider = function( o ) {

	var s = {
		'w': 9000,
		'f': 2000,
		's': true
	};

	if (typeof o == 'object')	{
		if (typeof o.showPosition != 'undefined') s.s = o.showPosition;
		if (typeof o.wait != 'undefined') s.w = o.wait;
		if (typeof o.fade != 'undefined') s.f = o.fade;
		if (s.f < 1) s.f = 1000;
		if (s.w <= s.f) s.w = s.f + 100;
	}

	var _t = false;
	var e = [];
	var _i = false;
	var _o = false;
	var _p = false;
	var _pb = false;
	var t = false;
	var p = 0;
	var i = 0;
	var _w = this.width();

	var c = function(d) {
		clearTimeout(_t);
		p += p * (d < 0) ? -1 : 1;
		if (p < 0) p = e.length;
		if (p >= e.length) p = 0;
		var el = e[p];
		_p.text((p + 1) + ' / ' + e.length);
		_pb.text((p + 1) + ' / ' + e.length);

		if (!(i % 2)) {
			_o.css('background-image', $(el).css('background-image')).css('left', _w);
			_o.animate({left: '-='+ _w +'px'}, {duration: s.f});
			_i.animate({left: '-='+ _w +'px'}, {duration: s.f});
		} else {
			_i.css('background-image', $(el).css('background-image')).css('left', _w);
			_i.animate({left: '-='+ _w +'px'}, {duration: s.f});
			_o.animate({left: '-='+ _w +'px'}, {duration: s.f});
		}

		i++;
		_t = setTimeout(c, s.w);
	}

	e = this.children();
	this.html('').css({'overflow': 'hidden', 'position': 'relative'});

	t = $('<div></div>').addClass('slider-p').css({'display': 'block', 'position': 'absolute', 'width': this.width(), 'height': '20px', 'color': '#fff', 'text-align': 'right', 'font-weight': 'bold', 'text-shadow': '0 0 2px #000'});
	_p = t.clone().css({'right': '6px', 'bottom': '1px'}).text((p + 1) + ' / ' + e.length);
	_pb = t.clone().css({'right': '5px', 'bottom': '0px', 'color': '#000'}).text((p + 1) + ' / ' + e.length);

	t = $('<div></div>').addClass('slider-image').css({'display': 'block', 'position': 'absolute', 'width': this.width(), 'height': this.height(), 'background-color': 'transparent', 'background-repeat': 'no-repeat', 'background-position': '50% 50%'});
	_i = t.clone().css('background-image', $(e[p]).css('background-image'));
	_o = t.clone().css('left', _w);

	this.append(_i).append(_o);
	if (s.s == true)
		this.append(_pb).append(_p);

	if (e.length > 1)
		_t = setTimeout(c, s.w);

};


