Index: wp-includes/script-loader.php
===================================================================
--- wp-includes/script-loader.php	(revision 5935)
+++ wp-includes/script-loader.php	(working copy)
@@ -142,6 +142,7 @@
 				'saveText' => attribute_escape(__('Save &raquo;')),
 				'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.")
 			) );
+			$this->add( 'word-count', '/wp-admin/js/word-count.js', array( 'jquery' ), '20070823' );
 		}
 	}
 
Index: wp-admin/wp-admin.css
===================================================================
--- wp-admin/wp-admin.css	(revision 5935)
+++ wp-admin/wp-admin.css	(working copy)
@@ -626,6 +626,13 @@
 	margin-bottom: 3px;
 }
 
+#quicktags .wp-word-count {
+	position: relative;
+	padding: 3px;
+	margin: 4px 4px 3px;
+	top: -2px;
+}
+
 #title {
 	font-size: 1.7em;
 	padding: 4px 3px;
@@ -1348,4 +1355,4 @@
 
 .plugin-update {
 	text-align: left;
-}
\ No newline at end of file
+}
Index: wp-admin/js/word-count.js
===================================================================
--- wp-admin/js/word-count.js	(revision 0)
+++ wp-admin/js/word-count.js	(revision 0)
@@ -0,0 +1,29 @@
+jQuery( function($) {
+	var w = $("<span class='wp-word-count'><a href='#'>Count&nbsp;words</a><span id='word-count'></span></span>").appendTo('#ed_toolbar');
+	if ( $.browser.safari ) { w.css( 'top', 0 ); } // Lame
+	else if ( $.browser.msie ) { w.css( 'top', '-8px' ); }
+
+	var wc = function(text) { var t = $.trim(text); w.children('span').html( ':&nbsp;' + ( t ? $("<div>" + t + "</div>").text().split( /\b[^\w']+\b/ ).length.toString() : '0' ) ); };
+
+	$('a', w).click( function() {
+		if ( 'undefined' != typeof tinyMCE && $.isFunction(tinyMCE.getContent) ) {
+			var t = tinyMCE.getContent();
+			if ( t ) { wc( t ); tinyMCE.selectedInstance.getWin().focus(); return false; }
+		}
+		wc( $('#content').focus().val() );
+		return false;
+	} ).click();
+
+	if ( 'undefined' == typeof tinyMCE ) { return; }
+	w.removeClass().addClass( 'mceStatusbarPathText' ).css( 'border-right', '1px solid #ccc' ).insertBefore('#mce_editor_0_path');
+
+	if ( 'undefined' == typeof TinyMCE_wordpressPlugin ) { return; }
+	var cl = TinyMCE_wordpressPlugin.cleanup;
+	TinyMCE_wordpressPlugin.cleanup = function(t,c,i) {
+		if ( 'submit_content' == t )
+			w.removeClass().addClass( 'wp-word-count' ).css( 'border-right', 'none' ).appendTo('#ed_toolbar');
+		else if ( 'setup_content_dom' == t )
+			w.removeClass().addClass( 'mceStatusbarPathText' ).css( 'border-right', '1px solid #ccc' ).insertBefore('#mce_editor_0_path');
+		return cl(t,c,i);
+	};
+} );
Index: wp-admin/admin-header.php
===================================================================
--- wp-admin/admin-header.php	(revision 5935)
+++ wp-admin/admin-header.php	(working copy)
@@ -2,7 +2,7 @@
 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
 if (!isset($_GET["page"])) require_once('admin.php');
 if ( $editing ) {
-	wp_enqueue_script( array('dbx-admin-key?pagenow=' . attribute_escape($pagenow),'admin-custom-fields') );
+	wp_enqueue_script( array('dbx-admin-key?pagenow=' . attribute_escape($pagenow),'admin-custom-fields', 'word-count') );
 	if ( current_user_can('manage_categories') )
 		wp_enqueue_script( 'ajaxcat' );
 	if ( user_can_richedit() )

