(function($) {
	jQuery.fn.IDtabs = function() {
		var $target_elements	=	$(this);
		$target_elements
			.each
			(
				function()
				{
					if ($(this).is('ul'))
					{
						var $target_element	=	$(this);
						var tabs = [];
						var tabContainers = [];
						$(' > li',$target_element).each(function ()
							{
								var $a_element	=	$(this).find('>a');
								if ($a_element.length>=1)
								{
									var a_element					=	$a_element.get(0);
									
									var window_pathname_array	=	href_compatibility_regexp.exec(window.location.pathname);
									var window_pathname			=	window_pathname_array[window_pathname_array.length-1];
									
									var a_pathname_array			=	href_compatibility_regexp.exec(a_element.pathname);
									var a_pathname					=	a_pathname_array[a_pathname_array.length-1];
									if (a_pathname == window_pathname)
									{
										tabs.push(this);
										tabContainers.push($(a_element.hash).get(0));
									}
								}
							}
						);
						$(tabContainers)
							.hide()
						;
						$(tabs).find('a').click(function (e) {
							e.preventDefault();
							$(tabContainers)
								.hide()
								.filter(this.hash)
									.show()
							;
							$(tabs).removeClass('selected');
							$(this).parents('li:first').addClass('selected');

							return false;
						});
						$(tabs)
							.filter('.selected')
								.find('>a')
									.trigger('click')
						;
					}
				}
			)
		;
	};
})(jQuery);