diff -urp ../drupal/includes/common.inc includes/common.inc
--- ../drupal/includes/common.inc	2009-09-27 07:08:45.000000000 -0400
+++ includes/common.inc	2009-09-28 13:29:39.000000000 -0400
@@ -2656,7 +2656,7 @@ function drupal_add_css($data = NULL, $o
  *   (optional) An array of CSS files. If no array is provided, the default
  *   stylesheets array is used instead.
  * @return
- *   A string of XHTML CSS tags.
+ *   A string of themable XHTML CSS tags.
  */
 function drupal_get_css($css = NULL) {
   $output = '';
@@ -2695,33 +2695,34 @@ function drupal_get_css($css = NULL) {
 
   // If CSS preprocessing is off, we still need to output the styles.
   // Additionally, go through any remaining styles if CSS preprocessing is on and output the non-cached ones.
-  $rendered_css = array();
-  $inline_css = '';
-  $external_css = '';
-  $preprocess_items = array();
+	$inline_items = array();
+	$no_preprocess_items = array();
+	$external_items = array();
+	
+	// preprocess_items is a temp array of everything to be processed
+	// processed_items will store all processed files post-processing
+	$preprocess_items = array();
+	$processed_items = array();
+
   foreach ($css as $data => $item) {
-    // Loop through each of the stylesheets, including them appropriately based
-    // on their type.
+    // Loop through each of the stylesheets, adding them to the appropriate array to send to theme function
     switch ($item['type']) {
       case 'file':
         // Depending on whether aggregation is desired, include the file.
         if (!$item['preprocess'] || !($is_writable && $preprocess_css)) {
-          $rendered_css[] = '<link type="text/css" rel="stylesheet" media="' . $item['media'] . '" href="' . file_create_url($item['data']) . $query_string . '" />';
+          $no_preprocess_items[$item['media']][] = $item;
         }
         else {
           $preprocess_items[$item['media']][] = $item;
-          // Mark the position of the preprocess element,
-          // it should be at the position of the first preprocessed file.
-          $rendered_css['preprocess'] = '';
         }
         break;
-      case 'inline':
-        // Include inline stylesheets.
-        $inline_css .= drupal_load_stylesheet_content($item['data'], $item['preprocess']);
-        break;
       case 'external':
         // Preprocessing for external CSS files is ignored.
-        $external_css .= '<link type="text/css" rel="stylesheet" media="' . $item['media'] . '" href="' . $item['data'] . '" />' . "\n";
+				$external_items[$item['media']][] = $item;
+        break;
+			case 'inline':
+        // Include inline stylesheets.
+				$inline_items[] = $item;
         break;
     }
   }
@@ -2732,16 +2733,20 @@ function drupal_get_css($css = NULL) {
       // starting with "ad*".
       $filename = 'css_' . md5(serialize($items) . $query_string) . '.css';
       $preprocess_file = file_create_url(drupal_build_css_cache($items, $filename));
-      $rendered_css['preprocess'] .= '<link type="text/css" rel="stylesheet" media="' . $media . '" href="' . $preprocess_file . '" />' . "\n";
+			$item = array(
+				'type' => 'file',
+				'media'	=> $media,
+				'preprocess' => true,
+				'data'	=> $preprocess_file
+			);
+			$processed_items[$media][] = $item;
     }
   }
-  // Enclose the inline CSS with the style tag if required.
-  if (!empty($inline_css)) {
-    $inline_css = "\n" . '<style type="text/css">' . $inline_css .'</style>';
-  }
+	
+	$css_items = array_merge($no_preprocess_items,$processed_items,$external_items);
+	
+	return(theme('css',$css_items,false,$query_string).theme('css',$inline_items,true,$query_string));
 
-  // Output all the CSS files with the inline stylesheets showing up last.
-  return implode("\n", $rendered_css) . $external_css . $inline_css;
 }
 
 /**
@@ -4580,6 +4585,9 @@ function drupal_common_theme() {
     'status_messages' => array(
       'arguments' => array('display' => NULL),
     ),
+		'css' => array(
+      'arguments' => array('css' => NULL, 'inline' => FALSE, 'query_string' => ''),
+    ),
     'links' => array(
       'arguments' => array('links' => NULL, 'attributes' => array('class' => array('links')), 'heading' => array()),
     ),
diff -urp ../drupal/includes/theme.inc includes/theme.inc
--- ../drupal/includes/theme.inc	2009-09-21 02:36:54.000000000 -0400
+++ includes/theme.inc	2009-09-28 13:41:30.000000000 -0400
@@ -1374,6 +1374,46 @@ function theme_status_messages($display 
 }
 
 /**
+ * Return a themed set of XHTML <links> or <style> tags
+ *
+ * @param $css
+ *   For $inline == false styles, a keyed array of stylesheets that need to be outputted.
+ *   Each key corresponds to the media of the stylesheets contained therein. Example:
+ *     - all
+ *     - print
+ *   Each media type has a corresponding array of css_items like those returned by drupal_add_css().
+ *   For $inline == true styles, an array of inline styles to be outputted
+ * @param $inline
+ *   A boolean describing the styles to be outputted are inline or not
+ * @param $query_string
+ *   A string (usually obtained by variable_get('css_js_query_string', '0')) to be appended 
+ *   to the end of $inline == false filenames for cache-busting purposes
+ * @return
+ *   a string containing XHTML <link> tags or a <style> tag
+ */
+function theme_css($css,$inline=false,$query_string=''){
+	$output = '';
+	
+	if(!$inline){
+		$rendered_css = array();
+		foreach($css as $media=>$items){			
+			foreach($items as $item){
+				$rendered_css[] = '<link type="text/css" rel="stylesheet" media="' . $media . '" href="' . file_create_url($item['data']) . $query_string . '" />';
+			}
+		}
+		$output = implode("\n", $rendered_css);
+	}else{
+		$inline_css = '';
+		foreach($css as $item){
+			$inline_css .= drupal_load_stylesheet_content($item['data'], $item['preprocess']);
+		}
+		$output = !empty($inline_css) ? "\n" . '<style type="text/css">' . $inline_css .'</style>' : '';
+	}
+	
+	return $output;
+}
+
+/**
  * Return a themed set of links.
  *
  * @param $links
