Index: wp-admin/admin-ajax.php
===================================================================
--- wp-admin/admin-ajax.php	(revision 11931)
+++ wp-admin/admin-ajax.php	(working copy)
@@ -191,6 +191,78 @@
 	$x->send();
 }
 
+/**
+ * Handles heirarichal taxonomy meta_box add functions.  Called via admin_ajax
+ * posts with action: add-{taxonomy name}
+ *
+ * @since 2.9
+ *
+ */
+function _wp_ajax_add_heirarichal_term()
+{
+	$action = $_POST['action'];
+	$taxonomy = get_taxonomy(substr($action, 4));
+	if(!$taxonomy)
+		die('-1');
+	check_ajax_referer( $action );
+	if ( !current_user_can( 'manage_categories' ) )
+		die('-1');
+	$names = explode(',', $_POST['new'.$taxonomy->name]);
+	if ( 0 > $parent = (int) $_POST['new'.$taxonomy->name.'_parent'] )
+		$parent = 0;
+	$post_category = isset($_POST['post_category'])? (array) $_POST['post_category'] : array();
+	$checked_categories = array_map( 'absint', (array) $post_category );
+	$popular_ids = isset( $_POST['popular_ids'] ) ?
+			array_map( 'absint', explode( ',', $_POST['popular_ids'] ) ) :
+			false;
+
+	$x = new WP_Ajax_Response();
+	foreach ( $names as $cat_name ) {
+		$cat_name = trim($cat_name);
+		$category_nicename = sanitize_title($cat_name);
+		if ( '' === $category_nicename )
+			continue;
+
+		if(!($cat_id = is_term($cat_name, $taxonomy->name, $parent))) {
+			$cat_id = wp_insert_term($cat_name, $taxonomy->name, array('parent'=>$parent));
+		}
+		if ( is_array($cat_id) )
+				$cat_id = $cat_id['term_id'];
+		$checked_categories[] = $cat_id;
+		if ( $parent ) // Do these all at once in a second
+			continue;
+		$category = get_term( $cat_id, $taxonomy->name);
+		ob_start();
+			wp_terms_checklist( 0, array('taxonomy'=>$taxonomy->name, 'descendants_and_self'=>$cat_id, 'selected_cats'=>$checked_categories, 'popular_cats'=>$popular_ids));
+		$data = ob_get_contents();
+		ob_end_clean();
+		$x->add( array(
+			'what' =>	$taxonomy->name,
+			'id' => $cat_id,
+			'data' => $data,
+			'position' => -1
+		) );
+	}
+	if ( $parent ) { // Foncy - replace the parent and all its children
+		$parent = get_term($parent, $taxonomy->name);
+		ob_start();
+			global $post_ID;
+			wp_terms_checklist($post_ID, array('taxonomy' => $taxonomy->name));
+		$data = ob_get_contents();
+		ob_end_clean();
+		$x->add( array(
+			'what' => $taxonomy->name,
+			'id' => $parent->term_id,
+			'old_id' => $parent->term_id,
+			'data' => $data,
+			'position' => -1
+		) );
+
+	}
+	$x->send();
+	die();
+}
+
 $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
 switch ( $action = $_POST['action'] ) :
 case 'delete-comment' : // On success, die with time() instead of 1
@@ -388,58 +460,6 @@
 	_wp_ajax_delete_comment_response( $comment->comment_ID );
 	die( '0' );
 	break;
-case 'add-category' : // On the Fly
-	check_ajax_referer( $action );
-	if ( !current_user_can( 'manage_categories' ) )
-		die('-1');
-	$names = explode(',', $_POST['newcat']);
-	if ( 0 > $parent = (int) $_POST['newcat_parent'] )
-		$parent = 0;
-	$post_category = isset($_POST['post_category'])? (array) $_POST['post_category'] : array();
-	$checked_categories = array_map( 'absint', (array) $post_category );
-	$popular_ids = isset( $_POST['popular_ids'] ) ?
-			array_map( 'absint', explode( ',', $_POST['popular_ids'] ) ) :
-			false;
-
-	$x = new WP_Ajax_Response();
-	foreach ( $names as $cat_name ) {
-		$cat_name = trim($cat_name);
-		$category_nicename = sanitize_title($cat_name);
-		if ( '' === $category_nicename )
-			continue;
-		$cat_id = wp_create_category( $cat_name, $parent );
-		$checked_categories[] = $cat_id;
-		if ( $parent ) // Do these all at once in a second
-			continue;
-		$category = get_category( $cat_id );
-		ob_start();
-			wp_category_checklist( 0, $cat_id, $checked_categories, $popular_ids );
-		$data = ob_get_contents();
-		ob_end_clean();
-		$x->add( array(
-			'what' => 'category',
-			'id' => $cat_id,
-			'data' => $data,
-			'position' => -1
-		) );
-	}
-	if ( $parent ) { // Foncy - replace the parent and all its children
-		$parent = get_category( $parent );
-		ob_start();
-			dropdown_categories( 0, $parent );
-		$data = ob_get_contents();
-		ob_end_clean();
-		$x->add( array(
-			'what' => 'category',
-			'id' => $parent->term_id,
-			'old_id' => $parent->term_id,
-			'data' => $data,
-			'position' => -1
-		) );
-
-	}
-	$x->send();
-	break;
 case 'add-link-category' : // On the Fly
 	check_ajax_referer( $action );
 	if ( !current_user_can( 'manage_categories' ) )
Index: wp-admin/css/colors-classic.dev.css
===================================================================
--- wp-admin/css/colors-classic.dev.css	(revision 11931)
+++ wp-admin/css/colors-classic.dev.css	(working copy)
@@ -104,11 +104,11 @@
 }
 
 div.tabs-panel,
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs {
 	border-color: #dfdfdf;
 }
 
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs {
 	background-color: #f1f1f1;
 }
 
@@ -381,7 +381,7 @@
 	background:#faf9f7 !important;
 }
 
-#side-sortables #category-tabs .tabs a {
+#side-sortables .category-tabs .tabs a {
 	color: #333;
 }
 
@@ -1447,7 +1447,7 @@
 	background-color: #f5f5f5;
 }
 
-#post-body ul#category-tabs li.tabs a {
+#post-body ul.category-tabs li.tabs a {
 	color: #333;
 }
 
Index: wp-admin/css/colors-fresh.dev.css
===================================================================
--- wp-admin/css/colors-fresh.dev.css	(revision 11931)
+++ wp-admin/css/colors-fresh.dev.css	(working copy)
@@ -104,11 +104,11 @@
 }
 
 div.tabs-panel,
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs {
 	border-color: #dfdfdf;
 }
 
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs {
 	background-color: #f1f1f1;
 }
 
@@ -377,7 +377,7 @@
 	border-color: #dfdfdf;
 }
 
-#side-sortables #category-tabs .tabs a {
+#side-sortables .category-tabs .tabs a {
 	color: #333;
 }
 
@@ -1442,7 +1442,7 @@
 	background-color: #f5f5f5;
 }
 
-#post-body ul#category-tabs li.tabs a {
+#post-body ul.category-tabs li.tabs a {
 	color: #333;
 }
 
Index: wp-admin/css/press-this.dev.css
===================================================================
--- wp-admin/css/press-this.dev.css	(revision 11931)
+++ wp-admin/css/press-this.dev.css	(working copy)
@@ -304,11 +304,11 @@
 	display: none;
 }
 
-#category-adder {
+.category-adder {
 	padding: 4px 0;
 }
 
-#category-adder h4 {
+.category-adder h4 {
 	margin: 0 0 8px;
 }
 
@@ -335,23 +335,23 @@
 }
 
 #category-add input,
-#category-add-sumbit {
+.category-add-sumbit {
 	width: auto;
 }
 
 /* Categories */
-#categorydiv ul,
+.categorydiv ul,
 #linkcategorydiv ul {
 	list-style: none;
 	padding: 0;
 	margin: 0;
 }
 
-#categorydiv ul.categorychecklist ul {
+.categorydiv ul.categorychecklist ul {
 	margin-left: 18px;
 }
 
-#categorydiv div.tabs-panel {
+.categorydiv div.tabs-panel {
 	height: 140px;
 	overflow: auto;
 }
Index: wp-admin/edit-form-advanced.php
===================================================================
--- wp-admin/edit-form-advanced.php	(revision 11931)
+++ wp-admin/edit-form-advanced.php	(working copy)
@@ -65,15 +65,15 @@
 
 // all tag-style post taxonomies
 foreach ( get_object_taxonomies('post') as $tax_name ) {
+	$taxonomy = get_taxonomy($tax_name);
+	$label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name;
 	if ( !is_taxonomy_hierarchical($tax_name) ) {
-		$taxonomy = get_taxonomy($tax_name);
-		$label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name;
-
 		add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', 'post', 'side', 'core');
+	}	else {
+		add_meta_box($tax_name.'div', $label, 'post_categories_meta_box', 'post', 'side', 'core', array('taxonomy'=>$tax_name));
 	}
 }
 
-add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core');
 // add_meta_box('passworddiv', __('Privacy Options'), 'post_password_meta_box', 'post', 'side', 'core');
 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core');
 add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'core');
Index: wp-admin/includes/meta-boxes.php
===================================================================
--- wp-admin/includes/meta-boxes.php	(revision 11931)
+++ wp-admin/includes/meta-boxes.php	(working copy)
@@ -258,38 +258,48 @@
  *
  * @param object $post
  */
-function post_categories_meta_box($post) {
-?>
-<ul id="category-tabs">
-	<li class="tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
-	<li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
-</ul>
+function post_categories_meta_box($post, $box) {
+	$defaults = array(
+		'taxonomy' => 'category'
+	);
+	if(!isset($box['args']) || !is_array($args = $box['args']))
+	{
+		$args = array();
+	}
+	extract(array_merge($defaults, $args));
+	?>
+	<div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv">
+		<ul id="<?php echo $taxonomy; ?>-tabs" class="category-tabs">
+			<li class="tabs"><a href="#<?php echo $taxonomy; ?>-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
+			<li class="hide-if-no-js"><a href="#<?php echo $taxonomy; ?>-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
+		</ul>
 
-<div id="categories-pop" class="tabs-panel" style="display: none;">
-	<ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
-<?php $popular_ids = wp_popular_terms_checklist('category'); ?>
-	</ul>
-</div>
+		<div id="<?php echo $taxonomy; ?>-pop" class="tabs-panel" style="display: none;">
+			<ul id="<?php echo $taxonomy; ?>checklist-pop" class="categorychecklist form-no-clear" >
+				<?php $popular_ids = wp_popular_terms_checklist($taxonomy); ?>
+			</ul>
+		</div>
 
-<div id="categories-all" class="tabs-panel">
-	<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
-<?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
-	</ul>
-</div>
+		<div id="<?php echo $taxonomy; ?>-all" class="tabs-panel">
+			<ul id="<?php echo $taxonomy; ?>checklist" class="list:<?php echo $taxonomy?> categorychecklist form-no-clear">
+				<?php wp_terms_checklist($post->ID, array('taxonomy'=>$taxonomy, 'popular_cats'=> $popular_ids)) ?>
+			</ul>
+		</div>
 
-<?php if ( current_user_can('manage_categories') ) : ?>
-<div id="category-adder" class="wp-hidden-children">
-	<h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
-	<p id="category-add" class="wp-hidden-child">
-	<label class="screen-reader-text" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
-	<label class="screen-reader-text" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
-	<input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" />
-<?php	wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
-	<span id="category-ajax-response"></span></p>
-</div>
-<?php
-endif;
-
+		<?php if ( current_user_can('manage_categories') ) : ?>
+			<div id="<?php echo $taxonomy; ?>-adder" class="wp-hidden-children">
+				<h4><a id="<?php echo $taxonomy; ?>-add-toggle" href="#<?php echo $taxonomy; ?>-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
+				<p id="<?php echo $taxonomy; ?>-add" class="category-add wp-hidden-child">
+					<label class="screen-reader-text" for="new<?php echo $taxonomy; ?>"><?php _e( 'Add New Category' ); ?></label><input type="text" name="new<?php echo $taxonomy; ?>" id="new<?php echo $taxonomy; ?>" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
+					<label class="screen-reader-text" for="new<?php echo $taxonomy; ?>_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
+					<input type="button" id="<?php echo $taxonomy; ?>-add-submit" class="add:<?php echo $taxonomy ?>checklist:<?php echo $taxonomy ?>-add button category-add-sumbit" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" />
+					<?php	wp_nonce_field( 'add-'.$taxonomy, '_ajax_nonce', false ); ?>
+					<span id="<?php echo $taxonomy; ?>-ajax-response"></span>
+				</p>
+			</div>
+		<?php	endif; ?>
+	</div>
+	<?php
 }
 
 
Index: wp-admin/includes/template.php
===================================================================
--- wp-admin/includes/template.php	(revision 11931)
+++ wp-admin/includes/template.php	(working copy)
@@ -467,9 +467,15 @@
 
 	function start_el(&$output, $category, $depth, $args) {
 		extract($args);
+		if(empty($taxonomy))
+			$taxonomy = 'category';
 
+		if($taxonomy == 'category')
+			$name = 'post_category';
+		else
+			$name = 'tax_input['.$taxonomy.']';
 		$class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
-		$output .= "\n<li id='category-$category->term_id'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
+		$output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
 	}
 
 	function end_el(&$output, $category, $depth, $args) {
@@ -488,33 +494,59 @@
  * @param unknown_type $popular_cats
  */
 function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null ) {
+	wp_terms_checklist($post_id,
+		array(
+			'taxonomy' => 'category',
+			'descendants_and_self' => $descendants_and_self,
+			'selected_cats' => $selected_cats,
+			'popular_cats' => $popular_cats,
+			'walker' => $walker
+		)
+	);
+}
+
+/**
+ * Taxonomy independent version of wp_category_checklist
+ *
+ * @param int $post_id
+ * @param array $args
+ */
+function wp_terms_checklist($post_id = 0, $args = array())
+{
+	$defaults = array(
+		'descendants_and_self' => 0,
+		'selected_cats' => false,
+		'popular_cats' => false,
+		'walker' => null,
+		'taxonomy' => 'category'
+	);
+	extract(array_merge($defaults, $args));
+
 	if ( empty($walker) || !is_a($walker, 'Walker') )
 		$walker = new Walker_Category_Checklist;
 
 	$descendants_and_self = (int) $descendants_and_self;
 
-	$args = array();
+	$args = array('taxonomy'=>$taxonomy);
 
 	if ( is_array( $selected_cats ) )
 		$args['selected_cats'] = $selected_cats;
 	elseif ( $post_id )
-		$args['selected_cats'] = wp_get_post_categories($post_id);
+		$args['selected_cats'] =  wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids')));
 	else
 		$args['selected_cats'] = array();
 
 	if ( is_array( $popular_cats ) )
 		$args['popular_cats'] = $popular_cats;
 	else
-		$args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
-
+		$args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
 	if ( $descendants_and_self ) {
-		$categories = get_categories( "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" );
-		$self = get_category( $descendants_and_self );
+		$categories = (array) get_terms($taxonomy, "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" );
+		$self = get_term( $descendants_and_self, $taxonomy );
 		array_unshift( $categories, $self );
 	} else {
-		$categories = get_categories('get=all');
+		$categories = (array) get_terms($taxonomy, 'get=all');
 	}
-
 	// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
 	$checked_categories = array();
 	$keys = array_keys( $categories );
Index: wp-admin/js/post.dev.js
===================================================================
--- wp-admin/js/post.dev.js	(revision 11931)
+++ wp-admin/js/post.dev.js	(working copy)
@@ -210,7 +210,7 @@
 })(jQuery);
 
 jQuery(document).ready( function($) {
-	var noSyncChecks = false, syncChecks, catAddAfter, stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html(), sticky = '';
+	var stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html(), sticky = '';
 
 	// postboxes
 	postboxes.add_postbox_toggles('post');
@@ -227,73 +227,82 @@
 		$(this).suggest( 'admin-ajax.php?action=ajax-tag-search&tax='+tax, { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
 	});
 
-	// category tabs
-	$('#category-tabs a').click(function(){
-		var t = $(this).attr('href');
-		$(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
-		$('.tabs-panel').hide();
-		$(t).show();
-		if ( '#categories-all' == t )
-			deleteUserSetting('cats');
-		else
-			setUserSetting('cats','pop');
-		return false;
-	});
-	if ( getUserSetting('cats') )
-		$('#category-tabs a[href="#categories-pop"]').click();
+	$('.categorydiv').each(function(){
+		var this_id = $(this).attr('id'), noSyncChecks = false, syncChecks, catAddAfter, popularCats;
+		var taxonomy = this_id.split('-').pop();
+		var settingName = taxonomy+'_tab';
+		if(taxonomy == 'category')
+			settingName = 'cats';
 
-	// Ajax Cat
-	$('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
-	$('#category-add-sumbit').click(function(){$('#newcat').focus();});
+		// category tabs
+		$('#'+taxonomy+'-tabs a').click(function(){
+			var t = $(this).attr('href');
+			$(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
+			$('#taxonomy-'+taxonomy+' .tabs-panel').hide();
+			$(t).show();
+			if ( '#'+taxonomy+'-all' == t )
+				deleteUserSetting(settingName);
+			else
+				setUserSetting(settingName,'pop');
+			return false;
+		});
+		if ( getUserSetting(settingName) )
+			$('#'+this_id+' a[href="#'+taxonomy+'-pop"]').click();
 
-	syncChecks = function() {
-		if ( noSyncChecks )
-			return;
-		noSyncChecks = true;
-		var th = jQuery(this), c = th.is(':checked'), id = th.val().toString();
-		$('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
-		noSyncChecks = false;
-	};
+		// Ajax Cat
+		$('#new'+taxonomy).one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
+		$('#'+taxonomy+'-add-submit').click(function(){$('#new'+taxonomy).focus();});
 
-	popularCats = $('#categorychecklist-pop :checkbox').map( function() { return parseInt(jQuery(this).val(), 10); } ).get().join(',');
-	catAddBefore = function( s ) {
-		if ( !$('#newcat').val() )
-			return false;
-		s.data += '&popular_ids=' + popularCats + '&' + jQuery( '#categorychecklist :checked' ).serialize();
-		return s;
-	};
+		syncChecks = function() {
+			if ( noSyncChecks )
+				return;
+			noSyncChecks = true;
+			var th = jQuery(this), c = th.is(':checked'), id = th.val().toString();
+			$('#in-'+taxonomy+'-' + id + ', #in-'+taxonomy+'-category-' + id).attr( 'checked', c );
+			noSyncChecks = false;
+		};
 
-	catAddAfter = function( r, s ) {
-		var newCatParent = jQuery('#newcat_parent'), newCatParentOption = newCatParent.find( 'option[value="-1"]' );
-		$(s.what + ' response_data', r).each( function() {
-			var t = $($(this).text());
-			t.find( 'label' ).each( function() {
-				var th = $(this), val = th.find('input').val(), id = th.find('input')[0].id, name, o;
-				$('#' + id).change( syncChecks ).change();
-				if ( newCatParent.find( 'option[value="' + val + '"]' ).size() )
-					return;
-				name = $.trim( th.text() );
-				o = $( '<option value="' +  parseInt( val, 10 ) + '"></option>' ).text( name );
-				newCatParent.prepend( o );
+		popularCats = $('#'+taxonomy+'checklist-pop :checkbox').map( function() { return parseInt(jQuery(this).val(), 10); } ).get().join(',');
+		catAddBefore = function( s ) {
+			if ( !$('#new'+taxonomy).val() )
+				return false;
+			s.data += '&popular_ids=' + popularCats + '&' + jQuery( '#'+taxonomy+'checklist :checked' ).serialize();
+			return s;
+		};
+
+		catAddAfter = function( r, s ) {
+			var newCatParent = jQuery('#new'+taxonomy+'_parent'), newCatParentOption = newCatParent.find( 'option[value="-1"]' );
+			$(s.what + ' response_data', r).each( function() {
+				var t = $($(this).text());
+				t.find( 'label' ).each( function() {
+					var th = $(this), val = th.find('input').val(), id = th.find('input')[0].id, name, o;
+					$('#' + id).change( syncChecks ).change();
+					if ( newCatParent.find( 'option[value="' + val + '"]' ).size() )
+						return;
+					name = $.trim( th.text() );
+					o = $( '<option value="' +  parseInt( val, 10 ) + '"></option>' ).text( name );
+					newCatParent.prepend( o );
+				} );
+				newCatParentOption.attr( 'selected', 'selected' );
 			} );
-			newCatParentOption.attr( 'selected', 'selected' );
+		};
+
+		$('#'+taxonomy+'checklist').wpList( {
+			alt: '',
+			response: taxonomy+'-ajax-response',
+			addBefore: catAddBefore,
+			addAfter: catAddAfter
 		} );
-	};
 
-	$('#categorychecklist').wpList( {
-		alt: '',
-		response: 'category-ajax-response',
-		addBefore: catAddBefore,
-		addAfter: catAddAfter
-	} );
+		$('#'+taxonomy+'-add-toggle').click( function() {
+			$('#'+taxonomy+'-adder').toggleClass( 'wp-hidden-children' );
+			$('#'+taxonomy+'-tabs a[href="#'+taxonomy+'-all"]').click();
+			return false;
+		} );
 
-	$('#category-add-toggle').click( function() {
-		$('#category-adder').toggleClass( 'wp-hidden-children' );
-		$('#category-tabs a[href="#categories-all"]').click();
-		return false;
-	} );
+		$('#'+taxonomy+'checklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change(), sticky = '';
 
-	$('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change(), sticky = '';
+	});
 
 	function updateVisibility() {
 		if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
Index: wp-admin/rtl.dev.css
===================================================================
--- wp-admin/rtl.dev.css	(revision 11931)
+++ wp-admin/rtl.dev.css	(working copy)
@@ -298,7 +298,7 @@
 	margin-left: 0;
 	margin-right: 120px;
 }
-#post-body ul#category-tabs li.tabs {
+#post-body ul.category-tabs li.tabs {
 	-moz-border-radius: 0 3px 3px 0;
 	-webkit-border-top-left-radius: 0;
 	-webkit-border-top-right-radius: 3px;
@@ -309,7 +309,7 @@
 	border-bottom-left-radius: 0;
 	border-bottom-right-radius: 3px;
 }
-#post-body ul#category-tabs {
+#post-body ul.category-tabs {
 	float: right;
 	text-align: left;
 	margin: 0 0 0 -120px;
@@ -320,7 +320,7 @@
 }
 /* 1800 - 2000
 =================================== */
-#side-sortables #category-tabs li {
+#side-sortables .category-tabs li {
 	padding-right: 0;
 	padding-left: 8px;
 }
Index: wp-admin/wp-admin.dev.css
===================================================================
--- wp-admin/wp-admin.dev.css	(revision 11931)
+++ wp-admin/wp-admin.dev.css	(working copy)
@@ -1938,36 +1938,36 @@
 
 /* Categories */
 
-#category-adder {
+.category-adder {
 	margin-left: 120px;
 	padding: 4px 0;
 }
 
-#category-adder h4 {
+.category-adder h4 {
 	margin: 0 0 8px;
 }
 
-#side-sortables #category-adder {
+#side-sortables .category-adder {
 	margin: 0;
 }
 
-#post-body #category-add input, #category-add select {
+#post-body .category-add input, .category-add select {
 	width: 30%;
 }
 
-#side-sortables #category-add input {
+#side-sortables .category-add input {
 	width: 94%;
 }
 
-#side-sortables #category-add select {
+#side-sortables .category-add select {
 	width: 100%;
 }
 
-#category-add input#category-add-sumbit {
+#side-sortables .category-add input.category-add-sumbit, #post-body .category-add input.category-add-sumbit {
 	width: auto;
 }
 
-#post-body ul#category-tabs {
+#post-body ul.category-tabs {
 	float: left;
 	width: 120px;
 	text-align: right;
@@ -1976,11 +1976,11 @@
 	padding: 0;
 }
 
-#post-body ul#category-tabs li {
+#post-body ul.category-tabs li {
 	padding: 8px;
 }
 
-#post-body ul#category-tabs li.tabs {
+#post-body ul.category-tabs li.tabs {
 	-moz-border-radius: 3px 0 0 3px;
 	-webkit-border-top-left-radius: 3px;
 	-webkit-border-bottom-left-radius: 3px;
@@ -1990,12 +1990,12 @@
 	border-bottom-left-radius: 3px;
 }
 
-#post-body ul#category-tabs li.tabs a {
+#post-body ul.category-tabs li.tabs a {
 	font-weight: bold;
 	text-decoration: none;
 }
 
-#categorydiv div.tabs-panel,
+.categorydiv div.tabs-panel,
 #linkcategorydiv div.tabs-panel {
 	height: 150px;
 	overflow: auto;
@@ -2004,32 +2004,32 @@
 	border-width: 1px;
 }
 
-#post-body #categorydiv div.tabs-panel,
+#post-body .categorydiv div.tabs-panel,
 #post-body #linkcategorydiv div.tabs-panel {
 	margin: 0 5px 0 125px;
 }
 
-#side-sortables #category-tabs li {
+#side-sortables .category-tabs li {
 	display: inline;
 	padding-right: 8px;
 }
 
-#side-sortables #category-tabs a {
+#side-sortables .category-tabs a {
 	text-decoration: none;
 }
 
-#side-sortables #category-tabs {
+#side-sortables .category-tabs {
 	margin-bottom: 3px;
 }
 
-#categorydiv ul,
+.categorydiv ul,
 #linkcategorydiv ul {
 	list-style: none;
 	padding: 0;
 	margin: 0;
 }
 
-#categorydiv ul.categorychecklist ul,
+.categorydiv ul.categorychecklist ul,
 #linkcategorydiv ul.categorychecklist ul {
 	margin-left: 18px;
 }
@@ -2040,32 +2040,32 @@
 	line-height: 19px;
 }
 
-#category-adder h4 {
+.category-adder h4 {
 	margin-top: 4px;
 	margin-bottom: 0px;
 }
 
-#categorydiv .tabs-panel {
+.categorydiv .tabs-panel {
 	border-width: 3px;
 	border-style: solid;
 }
 
-ul#category-tabs {
+ul.category-tabs {
 	margin-top: 12px;
 }
 
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs {
 	border-style: solid solid none;
 	border-width: 1px 1px 0;
 }
 
-#post-body #category-tabs li.tabs {
+#post-body .category-tabs li.tabs {
 	border-style: solid none solid solid;
 	border-width: 1px 0 1px 1px;
 	margin-right: -1px;
 }
 
-ul#category-tabs li {
+ul.category-tabs li {
 	padding: 5px 8px;
 	-moz-border-radius: 3px 3px 0 0;
 	-webkit-border-top-left-radius: 3px;
Index: wp-includes/category-template.php
===================================================================
--- wp-includes/category-template.php	(revision 11931)
+++ wp-includes/category-template.php	(working copy)
@@ -331,6 +331,7 @@
  */
 function wp_dropdown_categories( $args = '' ) {
 	$defaults = array(
+		'taxonomy' => 'category',
 		'show_option_all' => '', 'show_option_none' => '',
 		'orderby' => 'id', 'order' => 'ASC',
 		'show_last_update' => 0, 'show_count' => 0,
@@ -351,7 +352,7 @@
 	if ( (int) $tab_index > 0 )
 		$tab_index_attribute = " tabindex=\"$tab_index\"";
 
-	$categories = get_categories( $r );
+	$categories = get_terms( $taxonomy, $r );
 	$name = esc_attr($name);
 	$class = esc_attr($class);
 
Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 11931)
+++ wp-includes/post.php	(working copy)
@@ -1924,6 +1924,14 @@
 		$tags = array();
 
 	$tags = is_array($tags) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") );
+
+	$taxonomy_obj = get_taxonomy($taxonomy);
+	if($taxonomy_obj->hierarchical)
+	{
+		$tags = array_map('intval', $tags);
+		$tags = array_unique($tags);
+	}
+
 	wp_set_object_terms($post_id, $tags, $taxonomy, $append);
 }
 
Index: wp-includes/taxonomy.php
===================================================================
--- wp-includes/taxonomy.php	(revision 11931)
+++ wp-includes/taxonomy.php	(working copy)
@@ -192,6 +192,9 @@
 	$args['name'] = $taxonomy;
 	$args['object_type'] = $object_type;
 	$wp_taxonomies[$taxonomy] = (object) $args;
+
+	//register meta_box
+	add_filter('wp_ajax_add-'.$taxonomy, '_wp_ajax_add_heirarichal_term');
 }
 
 //
