
jQuery.fn.superSimpleTabs = function (selected) {
	var sel = selected || 1;

	return this.each(function () {
		var ul	= jQuery(this);
		var ipl	= 'a[href^=#]';

		// Go through all the in-page links in the ul
		// and hide all but the selected's contents
		ul.find(ipl).each(function (i) {
			var link = jQuery(this);

			if ((i + 1) === sel) {
				link.addClass('current');
			}
			else {
				jQuery(link.attr('href')).hide();
			}
		});

		// When clicking the UL (or anything within)
		ul.click(function (e) {
			var clicked	= jQuery(e.target);
			var link	= false;

			if (clicked.is(ipl)) {
				link = clicked;
			}
			else {
				var parent = clicked.parents(ipl);

				if (parent.length) {
					link = parent;
				}
			}

			if (link) {
				var selected = ul.find('a.current');

				if (selected.length) {
					jQuery(selected.removeClass('current').attr('href')).hide();
				}

				jQuery(link.addClass('current').attr('href')).show();

				return false;
			}
		});
	});
};