Index: wp-includes/taxonomy.php
===================================================================
--- wp-includes/taxonomy.php	(revision 10210)
+++ wp-includes/taxonomy.php	(working copy)
@@ -17,8 +17,8 @@
  * @global array $wp_taxonomies
  */
 $wp_taxonomies = array();
-$wp_taxonomies['category'] = (object) array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count');
-$wp_taxonomies['post_tag'] = (object) array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count');
+$wp_taxonomies['category'] = (object) array('name' => 'category', 'object_type' => 'post', 'hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __('Categories'));
+$wp_taxonomies['post_tag'] = (object) array('name' => 'post_tag', 'object_type' => 'post', 'hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => __('Tags'));
 $wp_taxonomies['link_category'] = (object) array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false);
 
 /**
Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 10210)
+++ wp-includes/post.php	(working copy)
@@ -1493,7 +1493,15 @@
 	}
 
 	wp_set_post_categories( $post_ID, $post_category );
-	wp_set_post_tags( $post_ID, $tags_input );
+	// old-style tags_input
+	if ( !empty($tags_input) )
+		wp_set_post_tags( $post_ID, $tags_input );
+	// new-style support for all tag-like taxonomies
+	if ( !empty($tax_input) ) {
+		foreach ( $tax_input as $taxonomy => $tags ) {
+			wp_set_post_tax( $post_ID, $taxonomy, $tags );			
+		}
+	}
 
 	$current_guid = get_post_field( 'guid', $post_ID );
 
@@ -1680,7 +1688,10 @@
  * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise
  */
 function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) {
+	return wp_set_post_tax( $post_id, 'post_tag', $tags, $append);
+}
 
+function wp_set_post_tax( $post_id = 0, $taxonomy='post_tag', $tags = '', $append = false ) {
 	$post_id = (int) $post_id;
 
 	if ( !$post_id )
@@ -1689,7 +1700,7 @@
 	if ( empty($tags) )
 		$tags = array();
 	$tags = (is_array($tags)) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") );
-	wp_set_object_terms($post_id, $tags, 'post_tag', $append);
+	wp_set_object_terms($post_id, $tags, $taxonomy, $append);
 }
 
 /**
Index: wp-includes/js/autosave.js
===================================================================
--- wp-includes/js/autosave.js	(revision 10210)
+++ wp-includes/js/autosave.js	(working copy)
@@ -130,10 +130,14 @@
 		post_ID:  jQuery("#post_ID").val() || 0,
 		post_title: jQuery("#title").val() || "",
 		autosavenonce: jQuery('#autosavenonce').val(),
-		tags_input: jQuery("#tags-input").val() || "",
+		//tags_input: jQuery("#tags-input").val() || "",
 		post_type: jQuery('#post_type').val() || "",
 		autosave: 1
 	};
+	
+	jQuery('.tags-input').each( function() {
+		post_data[this.name] = this.value;
+	} );
 
 	// We always send the ajax request in order to keep the post lock fresh.
 	// This (bool) tells whether or not to write the post to the DB during the ajax request.
Index: wp-content/themes/default/functions.php
===================================================================
--- wp-content/themes/default/functions.php	(revision 10210)
+++ wp-content/themes/default/functions.php	(working copy)
@@ -4,6 +4,26 @@
  * @subpackage Default_Theme
  */
 
+// FIXME: testing only, to be removed 
+//function add_test_taxonomies_alex() { 
+//register_taxonomy( 
+//'people', 
+//array('attachment:image', 'attachment:video', 'attachment:audio', 'post', 'page'), 
+//array( 
+//'label' => __('People'), 
+//'template' => __('People: %l.'), 
+//'helps' => __('Separate people with commas.'), 
+//'sort' => true, 
+//'args' => array('orderby' => 'term_order'), 
+//'rewrite' => array('slug' => 'person'), 
+//) 
+//); 
+//        register_taxonomy( 'post_place', 'post' ); 
+//} 
+ 
+//add_action('init', 'add_test_taxonomies_alex'); 
+ 
+
 if ( function_exists('register_sidebar') )
     register_sidebar(array(
         'before_widget' => '<li id="%1$s" class="widget %2$s">',
Index: wp-admin/admin-ajax.php
===================================================================
--- wp-admin/admin-ajax.php	(revision 10210)
+++ wp-admin/admin-ajax.php	(working copy)
@@ -776,7 +776,6 @@
 	global $current_user;
 
 	$_POST['post_category'] = explode(",", $_POST['catslist']);
-	$_POST['tags_input'] = explode(",", $_POST['tags_input']);
 	if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
 		unset($_POST['post_category']);
 
Index: wp-admin/wp-admin.css
===================================================================
--- wp-admin/wp-admin.css	(revision 10210)
+++ wp-admin/wp-admin.css	(working copy)
@@ -1355,7 +1355,7 @@
 	display: none;
 }
 
-#post-body #tagsdiv #newtag {
+#post-body .tagsdiv #newtag {
 	margin-right: 5px;
 	width: 16em;
 }
@@ -1364,7 +1364,7 @@
 	width: 94%
 }
 
-#side-info-column #tagsdiv #newtag {
+#side-info-column .tagsdiv #newtag {
 	width: 68%;
 }
 
@@ -1421,18 +1421,18 @@
 	padding: 5px 0;
 }
 
-#tagchecklist {
+.tagchecklist {
 	margin-left: 10px;
 	font-size: 12px;
 	overflow: auto;
 }
 
-#tagchecklist strong {
+.tagchecklist strong {
 	margin-left: -8px;
 	position: absolute;
 }
 
-#tagchecklist span {
+.tagchecklist span {
 	margin-right: 25px;
 	display: block;
 	float: left;
@@ -1442,7 +1442,7 @@
 	cursor: default;
 }
 
-#tagchecklist span a {
+.tagchecklist span a {
 	margin: 6px 0pt 0pt -9px;
 	cursor: pointer;
 	width: 10px;
@@ -2830,7 +2830,7 @@
 	margin-top: 8px;
 }
 
-#tagsdiv #the-tagcloud {
+.tagsdiv #the-tagcloud {
 	margin: 5px 5px 10px;
 	padding: 8px;
 	border-width: 1px;
Index: wp-admin/includes/taxonomy.php
===================================================================
--- wp-admin/includes/taxonomy.php	(revision 10210)
+++ wp-admin/includes/taxonomy.php	(working copy)
@@ -239,4 +239,24 @@
 	return wp_insert_term($tag_name, 'post_tag');
 }
 
+//
+// Other
+//
+
+// equivalent to get_tags_to_edit(), but for any tag-like taxonomy
+function get_tax_to_edit( $post_id, $taxonomy ) {
+	$post_id = (int) $post_id;
+	if ( !$post_id )
+		return false;
+
+	$tags = wp_get_object_terms( $post_id, $taxonomy, array('fields'=>'names') );
+	if ( !$tags )
+		return false;
+	
+	$tags_to_edit = join( ', ', $tags );
+	$tags_to_edit = attribute_escape( $tags_to_edit );
+	$tags_to_edit = apply_filters( 'tax_to_edit', $tags_to_edit, $taxonomy );
+	return $tags_to_edit;
+}
+
 ?>
Index: wp-admin/includes/template.php
===================================================================
--- wp-admin/includes/template.php	(revision 10210)
+++ wp-admin/includes/template.php	(working copy)
@@ -2695,7 +2695,7 @@
  * @param string $context The context within the page where the boxes should show ('normal', 'advanced').
  * @param string $priority The priority within the context where the boxes should show ('high', 'low').
  */
-function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default') {
+function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default', $callback_args=null) {
 	global $wp_meta_boxes;
 
 	if ( !isset($wp_meta_boxes) )
@@ -2742,7 +2742,7 @@
 	if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
 		$wp_meta_boxes[$page][$context][$priority] = array();
 
-	$wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
+	$wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args);
 }
 
 /**
Index: wp-admin/js/post.js
===================================================================
--- wp-admin/js/post.js	(revision 10210)
+++ wp-admin/js/post.js	(working copy)
@@ -1,9 +1,21 @@
 // this file contains all the scripts used in the post/edit page
 
+// return an array with any duplicate, whitespace or values removed
+function array_unique_noempty(a) {
+	out = [];
+	jQuery.each( a, function( key, val ) {
+		val.replace( /^\s+/, '' ).replace( /\s+$/, '' ); // trim
+		if ( val && !val.match(/\s+$/) && jQuery.inArray(val, out) == -1 )
+			out.push(val);
+		} );
+	return out;
+}
+
 function new_tag_remove_tag() {
 	var id = jQuery( this ).attr( 'id' );
-	var num = id.substr( 10 );
-	var current_tags = jQuery( '#tags-input' ).val().split(',');
+	var num = id.split('-check-num-')[1];
+	var taxbox = jQuery(this).parents('.tagsdiv');
+	var current_tags = taxbox.find( '.tags-input' ).val().split(',');
 	delete current_tags[num];
 	var new_tags = [];
 	jQuery.each( current_tags, function( key, val ) {
@@ -11,67 +23,90 @@
 			new_tags = new_tags.concat( val );
 		}
 	});
-	jQuery( '#tags-input' ).val( new_tags.join( ',' ).replace( /\s*,+\s*/, ',' ).replace( /,+/, ',' ).replace( /,+\s+,+/, ',' ).replace( /,+\s*$/, '' ).replace( /^\s*,+/, '' ) );
+	taxbox.find( '.tags-input' ).val( new_tags.join( ',' ).replace( /\s*,+\s*/, ',' ).replace( /,+/, ',' ).replace( /,+\s+,+/, ',' ).replace( /,+\s*$/, '' ).replace( /^\s*,+/, '' ) );
 	tag_update_quickclicks();
-	jQuery('#newtag').focus();
+	taxbox.find('input.newtag').focus(); 
 	return false;
 }
 
-function tag_update_quickclicks() {
-	if ( jQuery( '#tags-input' ).length == 0 )
+function tag_update_quickclicks(taxbox) {
+	if ( jQuery(taxbox).find('.tags-input').length == 0 ) 
 		return;
-	var current_tags = jQuery( '#tags-input' ).val().split(',');
-	jQuery( '#tagchecklist' ).empty();
+	var current_tags = jQuery(taxbox).find('.tags-input').val().split(',');
+	jQuery(taxbox).find( '.tagchecklist' ).empty(); 
 	shown = false;
 //	jQuery.merge( current_tags, current_tags ); // this doesn't work anymore, need something to array_unique
 	jQuery.each( current_tags, function( key, val ) {
 		val = val.replace( /^\s+/, '' ).replace( /\s+$/, '' ); // trim
 		if ( !val.match(/^\s+$/) && '' != val ) {
-			txt = '<span><a id="tag-check-' + key + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> ';
-			jQuery( '#tagchecklist' ).append( txt );
-			jQuery( '#tag-check-' + key ).click( new_tag_remove_tag );
-			shown = true;
+			var button_id = jQuery(taxbox).attr('id') + '-check-num-' + key; 
+ 			txt = '<span><a id="' + button_id + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> '; 
+ 			jQuery(taxbox).find( '.tagchecklist' ).append( txt ); 
+ 			jQuery( '#' + button_id ).click( new_tag_remove_tag ); 
 		}
 	});
 	if ( shown )
-		jQuery( '#tagchecklist' ).prepend( '<strong>'+postL10n.tagsUsed+'</strong><br />' );
+		jQuery(taxbox).find( '.tagchecklist' ).prepend( '<strong>'+postL10n.tagsUsed+'</strong><br />' );
 }
 
 function tag_flush_to_text(e,a) {
 	a = a || false;
 	var text = a ? jQuery(a).text() : jQuery('#newtag').val();
-	var newtags = jQuery('#tags-input').val();
-
-	var t = text.replace( /\s*([^,]+).*/, '$1,' );
-	newtags += ','
-
-	if ( newtags.indexOf(t) != -1 )
+	taxbox = jQuery(e.target).parents('.tagsdiv'); 
+	// is the input box empty (i.e. showing the 'Add new tag' tip)? 
+	if ( taxbox.find('input.newtag').hasClass('form-input-tip') ) 
 		return false;
-
-	newtags += text;
-
+	var newtags = taxbox.find('.tags-input').val() + ',' + taxbox.find('input.newtag').val(); 
 	// massage
 	newtags = newtags.replace( /\s+,+\s*/g, ',' ).replace( /,+/g, ',' ).replace( /,+\s+,+/g, ',' ).replace( /,+\s*$/g, '' ).replace( /^\s*,+/g, '' );
-	jQuery('#tags-input').val( newtags );
-	tag_update_quickclicks();
-	if ( ! a ) {
-		jQuery('#newtag').val('');
-		jQuery('#newtag').focus();
-	}
+	newtags = array_unique_noempty(newtags.split(',')).join(','); 
+	taxbox.find('.tags-input').val( newtags ); 
+	tag_update_quickclicks(taxbox); 
+	taxbox.find('input.newtag').val(''); 
+	taxbox.find('input.newtag').focus(); 
 	return false;
 }
 
 function tag_save_on_publish() {
-	if ( jQuery('#newtag').val() != postL10n.addTag )
-		tag_flush_to_text();
+	jQuery('.tagsdiv').each( function(i) { 
+		if ( !jQuery(this).find('input.newtag').hasClass('form-input-tip') ) 
+        	tag_flush_to_text(this); 
+		} ); 
 }
 
 function tag_press_key( e ) {
-	if ( 13 == e.keyCode ) {
-		tag_flush_to_text();
+	keycode = e.which; 
+	if ( 13 == e.which ) { 
+		tag_flush_to_text(e); 
 		return false;
 	}
 };
+function tag_init() { 
+        jQuery('.ajaxtag').show(); 
+        jQuery('.tagsdiv').each( function(i) { 
+                        tag_update_quickclicks(this); 
+                } ); 
+                 
+        // add the quickadd form 
+        jQuery('.ajaxtag input.tagadd').click( tag_flush_to_text ); 
+        jQuery('.ajaxtag input.newtag').focus(function() { 
+                if ( this.value == postL10n.addTag ) { 
+                        jQuery(this).val( '' ).removeClass( 'form-input-tip' ); 
+                } 
+        }); 
+        jQuery('.ajaxtag input.newtag').blur(function() { 
+                if ( this.value == '' ) { 
+                        jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' ); 
+                } 
+        }); 
+ 
+        // auto-save tags on post save/publish 
+        jQuery('#publish').click( tag_save_on_publish ); 
+        jQuery('#save-post').click( tag_save_on_publish ); 
+ 
+        // catch the enter key 
+        jQuery('.ajaxtag input.newtag').keypress( tag_press_key ); 
+} 
 
 (function($){
 	tagCloud = {
@@ -107,29 +142,13 @@
 	// Editable slugs
 	make_slugedit_clickable();
 
-	jQuery('#tags-input').hide();
-	tag_update_quickclicks();
-	// add the quickadd form
-	jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="button" class="button" id="tagadd" value="' + postL10n.add + '" tabindex="3" /><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>');
-	jQuery('#tagadd').click( tag_flush_to_text );
-	jQuery('#newtag').focus(function() {
-		if ( this.value == postL10n.addTag )
-			jQuery(this).val( '' ).removeClass( 'form-input-tip' );
-	});
-	jQuery('#newtag').blur(function() {
-		if ( this.value == '' )
-			jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
-	});
+	// prepare the tag UI
+	tag_init();
 
-	// auto-save tags on post save/publish
-	jQuery('#publish').click( tag_save_on_publish );
-	jQuery('#save-post').click( tag_save_on_publish );
-
 	jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } );
 
 	// auto-suggest stuff
-	jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
-	jQuery('#newtag').keypress( tag_press_key );
+	jQuery('.newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); 
 
 	// category tabs
 	var categoryTabs =jQuery('#category-tabs').tabs();
Index: wp-admin/rtl.css
===================================================================
--- wp-admin/rtl.css	(revision 10210)
+++ wp-admin/rtl.css	(working copy)
@@ -211,7 +211,7 @@
 #normal-sortables .postbox .submit {
 	float: left;
 }
-#post-body #tagsdiv #newtag {
+#post-body .tagsdiv #newtag {
 	margin-right: 0;
 	margin-left: 5px;
 }
@@ -221,18 +221,18 @@
 #comment-status-radio input {
 	margin: 2px 0 5px 3px;
 }
-#tagchecklist {
+.tagchecklist {
 	margin-left: 0;
 	margin-right: 10px;
 }
-#tagchecklist strong {
+.tagchecklist strong {
 	margin-left: 0;
 	margin-right: -8px;
 }
-#tagchecklist span {
+.tagchecklist span {
 	float: right;
 }
-#tagchecklist span a {
+.tagchecklist span a {
 	margin: 6px -9px 0 0;
 	float: right;
 }
Index: wp-admin/edit-form-advanced.php
===================================================================
--- wp-admin/edit-form-advanced.php	(revision 10210)
+++ wp-admin/edit-form-advanced.php	(working copy)
@@ -263,15 +263,42 @@
  *
  * @param object $post
  */
-function post_tags_meta_box($post) {
+function post_tags_meta_box($post, $box) {
+	$taxonomy = $box['args']['taxonomy']; 
+	$helps    = $box['args']['helps']; 
 ?>
-<p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>
-<div id="tagchecklist"></div>
+<div class="tagsdiv"> 
+	<p class="jaxtag">
+		<label class="hidden" for="newtag"><?php _e( $box['title'] ); ?></label>
+		<input type="hidden" name="<?php echo "tax_input[$taxonomy]"; ?>" class="tags-input" id="tax-input[<?php echo $taxonomy; ?>]" size="40" tabindex="3" value="<?php echo get_tax_to_edit( $post->ID, $taxonomy ); ?>" /> 
+	 
+	<span class="ajaxtag" style="display:none;">
+		<input type="text" name="newtag[<?php echo $taxonomy; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php _e('Add new tag'); ?>" />
+		<input type="button" class="button tagadd" value="<?php _e('Add'); ?>" tabindex="3" />
+		<input type="hidden"/><input type="hidden"/>
+		<span class="howto"><?php echo $helps; ?></span>
+	</span>
+	</p> 
+	<div class="tagchecklist"></div> 
+</div> 
 <p id="tagcloud-link" class="hide-if-no-js"><a href='#'><?php _e( 'Choose from the most popular tags' ); ?></a></p>
 <?php
 }
-add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'side', 'core');
 
+// all tag-style post taxonomies 
+foreach ( get_object_taxonomies('post') as $_tax ) { 
+	if ( !is_taxonomy_hierarchical($_tax) ) { 
+		$taxonomy = get_taxonomy($_tax); 
+		
+		$label = ( isset($taxonomy->label) ? $taxonomy->label : $_tax ); 
+		$helps = ( isset($taxonomy->helps) ? $taxonomy->helps : '' );
+		
+		$tags_to_edit = get_tax_to_edit( $post_ID, $_tax ); 
+		
+		add_meta_box('tagsdiv-'.$_tax, $label, 'post_tags_meta_box', 'post', 'side', 'core', array('taxonomy' => $_tax, 'helps' => $helps ) ); 
+	} 
+} 
+	
 /**
  * Display post categories form fields.
  *
Index: wp-admin/css/ie-rtl.css
===================================================================
--- wp-admin/css/ie-rtl.css	(revision 10210)
+++ wp-admin/css/ie-rtl.css	(working copy)
@@ -44,7 +44,7 @@
 	padding-right: 0;
 	padding-left: 1px;
 }
-#tagchecklist span a {
+.tagchecklist span a {
 	margin: 4px -9px 0 0;
 }
 .widefat th input {
Index: wp-admin/css/ie.css
===================================================================
--- wp-admin/css/ie.css	(revision 10210)
+++ wp-admin/css/ie.css	(working copy)
@@ -245,7 +245,7 @@
 li.widget-list-control-item h4,
 .widget-sortable,
 .widget-control-actions,
-#tagchecklist,
+.tagchecklist,
 #col-container,
 #col-left,
 #col-right {
@@ -296,12 +296,12 @@
 	padding-right: 1px;
 }
 
-#tagchecklist span, #tagchecklist span a {
+.tagchecklist span, .tagchecklist span a {
 	display: inline-block;
 	display: block;
 }
 
-#tagchecklist span a {
+.tagchecklist span a {
 	margin: 4px 0 0 -9px;
 }
 
Index: wp-admin/css/colors-fresh.css
===================================================================
--- wp-admin/css/colors-fresh.css	(revision 10210)
+++ wp-admin/css/colors-fresh.css	(working copy)
@@ -682,12 +682,12 @@
 	color: #448abd;
 }
 
-#tagchecklist span a,
+.tagchecklist span a,
 #bulk-titles div a {
 	background: url(../images/xit.gif) no-repeat;
 }
 
-#tagchecklist span a:hover,
+.tagchecklist span a:hover,
 #bulk-titles div a:hover {
 	background: url(../images/xit.gif) no-repeat -10px 0;
 }
@@ -1007,7 +1007,7 @@
 
 #timestampdiv input,
 #namediv input,
-#tagsdiv #the-tagcloud {
+.tagsdiv #the-tagcloud {
 	border-color: #ddd;
 }
 
Index: wp-admin/css/colors-classic.css
===================================================================
--- wp-admin/css/colors-classic.css	(revision 10210)
+++ wp-admin/css/colors-classic.css	(working copy)
@@ -682,12 +682,12 @@
 	color: #448abd;
 }
 
-#tagchecklist span a,
+.tagchecklist span a,
 #bulk-titles div a {
 	background: url(../images/xit.gif) no-repeat;
 }
 
-#tagchecklist span a:hover,
+.tagchecklist span a:hover,
 #bulk-titles div a:hover {
 	background: url(../images/xit.gif) no-repeat -10px 0;
 }
@@ -1007,7 +1007,7 @@
 
 #timestampdiv input,
 #namediv input,
-#tagsdiv #the-tagcloud {
+.tagsdiv #the-tagcloud {
 	border-color: #ddd;
 }
 
