(function($){  
	$.fn.extend({   
		ajaxtabs: function() {  
			return this.each(function() {  
				var self = this;

				/* select the first tab. */
				$(this).find('a').first().addClass('active');

				/* hide all content but the first one. */
				$(this).find('a:not(:first)').each(function() {
					var href = $(this).attr('href');
					/* Strip filename out for IE7 */
					href = href.replace(/^[^#]*/, '');
					$(href).hide();
				});

				/* when the radio button changes, change the content below. */
				$(this).find('a').click(function(event) {
					/* don't update the location in the url bar. */
					event.preventDefault();

					/* hide all content panels. */
					$(self).find('a').each(function() {
						var href = $(this).attr('href');
						/* Strip filename out for IE7 */
						href = href.replace(/^[^#]*/, '');
						$(href).hide();
					});

					/* show the one that was clicked. */	
					var href = $(this).attr('href');
					/* Strip filename out for IE7 */
					href = href.replace(/^[^#]*/, '');
					$(href).show();

					/* update the classname showing which tab is 'active'. */
					$(self).find('a').removeClass('active');
					$(this).addClass('active');
				});
			});
		}  
	});  
})(jQuery);  

