Index: trunk/wp-includes/category.php
===================================================================
--- a/trunk/wp-includes/category.php
+++ b/trunk/wp-includes/category.php
@@ -175,13 +175,21 @@
 /**
  * Retrieve the name of a category from its ID.
  *
  * @since 1.0.0
  *
  * @param int $cat_id Category ID
  * @return string Category name
  */
 function get_cat_name( $cat_id ) {
 	$cat_id = (int) $cat_id;
 	$category = &get_category( $cat_id );
 	return $category->name;
 }

+ function get_category_root($cat_id = 0) {
+         $category_parent = get_category($cat_id);
+         while( ! empty( $category_parent->category_parent ) ) { 
+                 $category_parent = get_category($category_parent->category_parent);
+         }   
+         return ! empty( $category_parent->term_id ) ? $category_parent->term_id : $cat_id;
+ }