Index: wp-includes/functions-formatting.php
===================================================================
--- wp-includes/functions-formatting.php	(revision 3659)
+++ wp-includes/functions-formatting.php	(working copy)
@@ -101,8 +101,10 @@
 	$text = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/', '&#038;$1', $text);-
 	$text = str_replace('<', '&lt;', $text);
 	$text = str_replace('>', '&gt;', $text);
-	if ( $quotes ) {
+	if ( 'double' == $quotes ) {
 		$text = str_replace('"', '&quot;', $text);
+	} elseif ( $quotes ) {
+		$text = str_replace('"', '&quot;', $text);
 		$text = str_replace("'", '&#039;', $text);
 	}
 	return $text;
Index: wp-includes/js/fat.js
===================================================================
--- wp-includes/js/fat.js	(revision 3659)
+++ wp-includes/js/fat.js	(working copy)
@@ -11,7 +11,7 @@
 		b = b.toString(16); if (b.length == 1) b = '0' + b;
 		return "#" + r + g + b;
 	},
-	fade_all : function ()
+	fade_all : function (dur)
 	{
 		var a = document.getElementsByTagName("*");
 		for (var i = 0; i < a.length; i++) 
@@ -21,7 +21,7 @@
 			if (r)
 			{
 				if (!r[1]) r[1] = "";
-				if (o.id) Fat.fade_element(o.id,null,null,"#"+r[1]);
+				if (o.id) Fat.fade_element(o.id,null,dur,"#"+r[1]);
 			}
 		}
 	},
@@ -87,4 +87,4 @@
 
 addLoadEvent(function ()  {
 	Fat.fade_all();
-});
\ No newline at end of file
+});
Index: wp-admin/custom-fields.js
===================================================================
--- wp-admin/custom-fields.js	(revision 0)
+++ wp-admin/custom-fields.js	(revision 0)
@@ -0,0 +1,25 @@
+addLoadEvent(customFieldsAddIn);
+function customFieldsAddIn() {
+	if (!theList.theList) return false;
+	inputs = theList.theList.getElementsByTagName('input');
+	for ( var i=0; i < inputs.length; i++ ) {
+		if ('text' == inputs[i].type) {
+			inputs[i].setAttribute('autocomplete', 'off');
+		        inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); };
+		}
+		if ('updatemeta' == inputs[i].className) {
+		        inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); };
+		}
+	}
+
+	document.getElementById('metakeyinput').onkeypress = function(e) {return killSubmit('theList.inputData+="&id="+document.getElementById("post_ID").value;theList.ajaxAdder("meta", "newmeta", customFieldsOnComplete);', e); };
+	document.getElementById('updatemetasub').onclick = function(e) {return killSubmit('theList.inputData+="&id="+document.getElementById("post_ID").value;theList.ajaxAdder("meta", "newmeta", customFieldsOnComplete);', e); };
+	theList.clearInputs.push('metakeyselect','metakeyinput','metavalue');
+}
+function customFieldsOnComplete() {
+	var pidEl = document.getElementById('post_ID');
+	pidEl.name = 'post_ID';
+	pidEl.value = getNodeValue(theList.ajaxAdd.responseXML, 'postid');
+	var aEl = document.getElementById('hiddenaction')
+	if ( aEl.value == 'post' ) aEl.value = 'postajaxpost';
+}
Index: wp-admin/edit-comments.php
===================================================================
--- wp-admin/edit-comments.php	(revision 3659)
+++ wp-admin/edit-comments.php	(working copy)
@@ -133,13 +133,13 @@
 			 | <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php _e('View Post') ?></a></p>
 		</li>
 
-<?php } // end foreach ?>
+<?php } // end foreach($comment) ?>
 </ol>
 
 <div id="ajax-response"></div>
 
 <?php
-	} else {
+	} else { //no comments to show
 
 		?>
 		<p>
@@ -162,19 +162,28 @@
   </tr>';
 		foreach ($comments as $comment) {
 		$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
+		$comment_status = wp_get_comment_status($comment->comment_ID);
 		$class = ('alternate' == $class) ? '' : 'alternate';
+		$class .= ('unapproved' == $comment_status) ? ' unapproved' : '';
 ?>
-  <tr class='<?php echo $class; ?>'>
+  <tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'>
     <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
     <td><?php comment_author_link() ?></td>
     <td><?php comment_author_email_link() ?></td>
     <td><a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></td>
     <td><?php comment_excerpt(); ?></td>
-    <td><a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit"><?php _e('View') ?></a></td>
+    <td>
+    	<?php if ('unapproved' == $comment_status) { ?>
+    		(Unapproved)
+    	<?php } else { ?>
+    		<a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit"><?php _e('View') ?></a>
+    	<?php } ?>
+    </td>
     <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
 	echo "<a href='comment.php?action=editcomment&amp;comment=$comment->comment_ID' class='edit'>" .  __('Edit') . "</a>"; } ?></td>
     <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
-            echo "<a href=\"comment.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), $comment->comment_author) . "')\"    class='delete'>" . __('Delete') . "</a>"; } ?></td>
+		echo "<a href=\"comment.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), wp_specialchars( $comment->comment_author, 1 ))  . "' );\" class='edit'>" . __('Delete') . "</a> ";
+		} ?></td>
   </tr>
 		<?php 
 		} // end foreach
@@ -183,6 +192,7 @@
             <p class="submit"><input type="submit" name="delete_button" value="<?php _e('Delete Checked Comments &raquo;') ?>" onclick="var numchecked = getNumChecked(document.getElementById('deletecomments')); if(numchecked < 1) { alert('<?php _e("Please select some comments to delete"); ?>'); return false } return confirm('<?php printf(__("You are about to delete %s comments permanently \\n  \'Cancel\' to stop, \'OK\' to delete."), "' + numchecked + '"); ?>')" />
 			<input type="submit" name="spam_button" value="<?php _e('Mark Checked Comments as Spam &raquo;') ?>" onclick="return confirm('<?php _e("You are about to mark these comments as spam \\n  \'Cancel\' to stop, \'OK\' to mark as spam.") ?>')" /></p>
   </form>
+<div id="ajax-response"></div>
 <?php
 	} else {
 ?>
Index: wp-admin/admin-ajax.php
===================================================================
--- wp-admin/admin-ajax.php	(revision 0)
+++ wp-admin/admin-ajax.php	(revision 0)
@@ -0,0 +1,209 @@
+<?php
+require_once('../wp-config.php');
+require_once('admin-functions.php');
+require_once('admin-db.php');
+
+define('DOING_AJAX', true);
+
+if ( !is_user_logged_in() )
+	die('-1');
+
+function get_out_now() { exit; }
+add_action( 'shutdown', 'get_out_now', -1 );
+
+function wp_clean_ajax_input( $i ) {
+	global $wpdb;
+	$i = is_array($i) ? array_map('wp_clean_ajax_input', $i) : $wpdb->escape( rawurldecode(stripslashes($i)) );
+	return $i;
+}
+
+function wp_ajax_echo_meta( $pid, $mid, $key, $value ) {
+	$r  = "<meta><id>$mid</id><postid>$pid</postid><newitem><![CDATA[<table><tbody>";
+	$r .= "<tr id='meta-$mid'><td valign='top'>";
+	$r .= "<input name='meta[$mid][key]' tabindex='6' onkeypress='return killSubmit(\"theList.ajaxUpdater(&#039;meta&#039;,&#039;meta-$mid&#039;);\",event);' type='text' size='20' value='$key' />";
+	$r .= "</td><td><textarea name='meta[$mid][value]' tabindex='6' rows='2' cols='30'>$value</textarea></td><td align='center'>";
+	$r .= "<input name='updatemeta' type='button' class='updatemeta' tabindex='6' value='Update' onclick='return theList.ajaxUpdater(&#039;meta&#039;,&#039;meta-$mid&#039;);' /><br />";
+	$r .= "<input name='deletemeta[$mid]' type='submit' onclick='return deleteSomething( \"meta\", $mid);' class='deletemeta' tabindex='6' value='Delete' />";
+	$r .= "</td></tr></tbody></table>]]></newitem></meta>";
+	return $r;
+}
+
+$_POST = wp_clean_ajax_input( $_POST );
+$id = (int) $_POST['id'];
+switch ( $_POST['action'] ) :
+case 'delete-comment' :
+	if ( !$comment = get_comment( $id ) )
+		die('0');
+	if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
+		die('-1');
+
+	if ( wp_delete_comment( $comment->comment_ID ) )
+		die('1');
+	else	die('0');
+	break;
+case 'delete-comment-as-spam' :
+	if ( !$comment = get_comment( $id ) )
+		die('0');
+	if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
+		die('-1');
+
+	if ( wp_set_comment_status( $comment->comment_ID, 'spam' ) )
+		die('1');
+	else	die('0');
+	break;
+case 'delete-cat' :
+	if ( !current_user_can( 'manage_categories' ) )
+		die('-1');
+
+	if ( wp_delete_category( $id ) )
+		die('1');
+	else	die('0');
+	break;
+case 'delete-link' :
+	if ( !current_user_can( 'manage_links' ) )
+		die('-1');
+
+	if ( wp_delete_link( $id ) )
+		die('1');
+	else	die('0');
+	break;
+case 'delete-meta' :
+	if ( !$meta = get_post_meta_by_id( $id ) )
+		die('0');
+	if ( !current_user_can( 'edit_post', $meta->post_id ) )
+		die('-1');
+	if ( delete_meta( $meta->meta_id ) )
+		die('1');
+	die('0');
+	break;
+case 'delete-post' :
+	if ( !current_user_can( 'delete_post', $id ) )
+		die('-1');
+
+	if ( wp_delete_post( $id ) )
+		die('1');
+	else	die('0');
+	break;
+case 'delete-page' :
+	if ( !current_user_can( 'delete_page', $id ) )
+		die('-1');
+
+	if ( wp_delete_post( $id ) )
+		die('1');
+	else	die('0');
+	break;
+case 'dim-comment' :
+	if ( !$comment = get_comment( $id ) )
+		die('0');
+	if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
+		die('-1');
+	if ( !current_user_can( 'moderate_comments' ) )
+		die('-1');
+
+	if ( 'unapproved' == wp_get_comment_status($comment->comment_ID) ) {
+		if ( wp_set_comment_status( $comment->comment_ID, 'approve' ) )
+			die('1');
+	} else {
+		if ( wp_set_comment_status( $comment->comment_ID, 'hold' ) )
+			die('1');
+	}
+	die('0');
+	break;
+case 'add-category' : // On the Fly
+	if ( !current_user_can( 'manage_categories' ) )
+		die('-1');
+	$names = explode(',', $_POST['newcat']);
+	$r = "<?xml version='1.0' standalone='yes'?><ajaxresponse>";
+	foreach ( $names as $cat_name ) {
+		$cat_name = trim($cat_name);
+		if ( !$category_nicename = sanitize_title($cat_name) )
+			die('0');
+		if ( !$cat_id = category_exists( $cat_name ) )
+			$cat_id = wp_create_category( $cat_name );
+		$cat_name = stripslashes($cat_name);
+		$r .= "<category><id>$cat_id</id><newitem><![CDATA[";
+		$r .= "<li id='category-$cat_id'><label for='in-category-$cat_id' class='selectit'>";
+		$r .= "<input value='$cat_id' type='checkbox' checked='checked' name='post_category[]' id='in-category-$cat_id'/> $cat_name</label></li>";
+		$r .= "]]></newitem></category>";
+	}
+	$r .= '</ajaxresponse>';
+	header('Content-type: text/xml');
+	die($r);
+	break;
+case 'add-cat' : // From Manage->Categories
+	if ( !current_user_can( 'manage_categories' ) )
+                die('-1');
+	if ( !$cat = wp_insert_category( $_POST ) )
+		die('0');
+	if ( !$cat = get_category( $cat ) )
+		die('0');
+	$pad = 0;
+	$_cat = $cat;
+	while ( $_cat->category_parent ) {
+		$_cat = get_category( $_cat->category_parent );
+		$pad++;
+	}
+	$pad = str_repeat('&#8212; ', $pad);
+
+	$r  = "<?xml version='1.0' standalone='yes'?><ajaxresponse>";
+	$r .= "<cat><id>$cat->cat_ID</id><newitem><![CDATA[<table><tbody>";
+	$r .= "<tr id='cat-$cat->cat_ID'><th scope='row'>$cat->cat_ID</th><td>$pad $cat->cat_name</td>";
+	$r .= "<td>$cat->category_description</td><td>$cat->category_count</td><td>$cat->link_count</td>";
+	$r .= "<td><a href='categories.php?action=edit&amp;cat_ID=$cat->cat_ID' class='edit'>" . __('Edit') . "</a></td>";
+	$r .= "<td><a href='categories.php?action=delete&amp;cat_ID=$cat->cat_ID' onclick='return deleteSomething( \"cat\", $cat->cat_ID, \"";
+	$r .= sprintf(__('You are about to delete the category \"%s\".  All of its posts and bookmarks will go to the default categories.\\n\"OK\" to delete, \"Cancel\" to stop.'), addslashes($cat->cat_name));
+	$r .= "\" );' class='delete'>".__('Delete')."</a></td></tr>";
+	$r .= "</tbody></table>]]></newitem></cat></ajaxresponse>";
+	header('Content-type: text/xml');
+	die($r);
+
+	break;
+case 'add-meta' :
+	if ( !current_user_can( 'edit_post', $id ) )
+		die('-1');
+	if ( $id < 0 ) {
+		if ( $pid = write_post() )
+			$meta = has_meta( $pid );
+		else
+			die('0');
+		$key = wp_specialchars( $meta[0]['meta_key'], true );
+		$value = wp_specialchars( $meta[0]['meta_value'], true );
+		$mid = (int) $meta[0]['meta_id'];
+	} else {
+		if ( $mid = add_meta( $id ) )
+			$meta = get_post_meta_by_id( $mid );
+		else
+			die('0');
+		$key = wp_specialchars($meta->meta_key, true);
+		$value = wp_specialchars($meta->meta_value, true);
+		$pid = (int) $meta->post_id;
+	}
+	$r = "<?xml version='1.0' standalone='yes'?><ajaxresponse>";
+	$r .= wp_ajax_echo_meta( $pid, $mid, $key, $value );
+	$r .= '</ajaxresponse>';
+	header('Content-type: text/xml');
+	die($r);
+	break;
+case 'update-meta' :
+	$mid = (int) array_pop(array_keys($_POST['meta']));
+	$key = $_POST['meta'][$mid]['key'];
+	$value = $_POST['meta'][$mid]['value'];
+	if ( !$meta = get_post_meta_by_id( $mid ) )
+		die('0');
+	if ( !current_user_can( 'edit_post', $meta->post_id ) )
+		die('-1');
+	$r = "<?xml version='1.0' standalone='yes'?><ajaxresponse>";
+	if ( $u = update_meta( $mid, $key, $value ) ) {
+		$key = wp_specialchars(stripslashes($key), true);
+		$value = wp_specialchars(stripslashes($value), true);
+		$r .= wp_ajax_echo_meta( $meta->post_id, $mid, $key, $value );
+	}
+	$r .= '</ajaxresponse>';
+	header('Content-type: text/xml');
+	die($r);
+	break;
+default :
+	die('0');
+	break;
+endswitch;
+?>
Index: wp-admin/list-manipulation.php
===================================================================
--- wp-admin/list-manipulation.php	(revision 3659)
+++ wp-admin/list-manipulation.php	(working copy)
@@ -1,69 +0,0 @@
-<?php
-require_once('../wp-config.php');
-require_once('admin-functions.php');
-require_once('admin-db.php');
-
-if ( !is_user_logged_in() )
-	die('-1');
-
-function get_out_now() { exit; }
-add_action( 'shutdown', 'get_out_now', -1 );
-
-//	check_admin_referer();
-
-$id = (int) $_POST['id'];
-switch ( $_POST['action'] ) :
-case 'delete-link' :
-	if ( !current_user_can( 'manage_links' ) )
-		die('-1');
-
-	if ( wp_delete_link( $id ) )
-		die('1');
-	else	die('0');
-	break;
-case 'delete-post' :
-	if ( !current_user_can( 'delete_post', $id ) )
-		die('-1');
-
-	if ( wp_delete_post( $id ) )
-		die('1');
-	else	die('0');
-	break;
-case 'delete-page' :
-	if ( !current_user_can( 'delete_page', $id ) )
-		die('-1');
-
-	if ( wp_delete_post( $id ) )
-		die('1');
-	else	die('0');
-	break;
-case 'delete-cat' :
-	if ( !current_user_can( 'manage_categories' ) )
-		die('-1');
-
-	if ( wp_delete_category( $id ) )
-		die('1');
-	else	die('0');
-	break;
-case 'delete-comment' :
-	if ( !$comment = get_comment( $id ) )
-		die('0');
-	if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
-		die('-1');
-
-	if ( wp_delete_comment( $comment->comment_ID ) )
-		die('1');
-	else	die('0');
-	break;
-case 'delete-comment-as-spam' :
-	if ( !$comment = get_comment( $id ) )
-		die('0');
-	if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
-		die('-1');
-
-	if ( wp_set_comment_status( $comment->comment_ID, 'spam' ) )
-		die('1');
-	else	die('0');
-	break;
-endswitch;
-?>
Index: wp-admin/edit-form-ajax-cat.php
===================================================================
--- wp-admin/edit-form-ajax-cat.php	(revision 3659)
+++ wp-admin/edit-form-ajax-cat.php	(working copy)
@@ -1,35 +0,0 @@
-<?php
-require_once('../wp-config.php');
-require_once('admin-functions.php');
-require_once('admin-db.php');
-
-if ( !current_user_can('manage_categories') )
-	die('-1');
-
-function get_out_now() { exit; }
-
-add_action('shutdown', 'get_out_now', -1);
-
-$names = explode(',', rawurldecode($_GET['ajaxnewcat']) );
-$ids   = array();
-
-foreach ($names as $cat_name) {
-	$cat_name = trim( $cat_name );
-
-	if ( !$category_nicename = sanitize_title($cat_name) )
-		continue;
-	if ( $already = category_exists($cat_name) ) {
-		$ids[] = (string) $already;
-		continue;
-	}
-
-	$new_cat_id = wp_create_category($cat_name);
-
-	$ids[] = (string) $new_cat_id;
-}
-
-$return = join(',', $ids);
-
-die( (string) $return );
-
-?>
\ No newline at end of file
Index: wp-admin/wp-admin.css
===================================================================
--- wp-admin/wp-admin.css	(revision 3659)
+++ wp-admin/wp-admin.css	(working copy)
@@ -91,11 +91,6 @@
 	padding: .1em .3em;
 }
 
-fieldset span.cat-nest {
-	display: block;
-	margin-left: 10px;
-}
-
 fieldset.options {
 	padding: 1em;
 }
@@ -326,6 +321,18 @@
 	color: #009ef0;
 }
 
+.approve {
+	display: none;
+}
+
+.unapproved .approve {
+	display: inline;
+}
+
+.unapproved .unapprove {
+	display: none;
+}
+
 .updated {
 	background: #CFEBF7 url(images/notice.gif) no-repeat 1em ;
 	border: 1px solid #2580B2;
@@ -804,11 +811,20 @@
 	margin-top: .5em;
 }
 
-#categorydiv div div {
+#categorydiv ul {
+	list-style: none;
+	padding: 0;
+	margin-left:10px;
+}
+#categorychecklist {
 	height: 12em;
 	overflow: auto;
+	margin-top: 8px;
 }
-
+#categorychecklist li {
+	margin: 0;
+	padding: 0;
+}
 #ajaxcat input {
 	border: 1px solid #ccc;
 }
@@ -951,4 +967,4 @@
 #jaxcat {
 	margin: 0;
 	padding: 0;
-}
\ No newline at end of file
+}
Index: wp-admin/post.php
===================================================================
--- wp-admin/post.php	(revision 3659)
+++ wp-admin/post.php	(working copy)
@@ -17,15 +17,15 @@
 		}
 	}
 }
-
 if (isset($_POST['deletepost']))
 $action = "delete";
 
 switch($action) {
+case 'postajaxpost':
 case 'post':
 	check_admin_referer();
 	
-	$post_ID = write_post();
+	$post_ID = 'post' == $action ? write_post() : edit_post();
 
 	// Redirect.
 	if (!empty($_POST['mode'])) {
Index: wp-admin/admin.php
===================================================================
--- wp-admin/admin.php	(revision 3659)
+++ wp-admin/admin.php	(working copy)
@@ -40,7 +40,7 @@
     }
 }
 
-$xfn_js = $sack_js = $list_js = $cat_js = $dbx_js = $editing = false;
+$xfn_js = $sack_js = $list_js = $cat_js = $dbx_js = $pmeta_js = $editing = false;
 
 require(ABSPATH . '/wp-admin/menu.php');
 
Index: wp-admin/admin-functions.php
===================================================================
--- wp-admin/admin-functions.php	(revision 3659)
+++ wp-admin/admin-functions.php	(working copy)
@@ -602,12 +602,12 @@
 
 function write_nested_categories($categories) {
 	foreach ($categories as $category) {
-		echo '<label for="category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : ""), '/> ', wp_specialchars($category['cat_name']), "</label>\n";
+		echo '<li id="category-', $category['cat_ID'], '"><label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : ""), '/> ', wp_specialchars($category['cat_name']), "</label></li>\n";
 
-		if (isset ($category['children'])) {
-			echo "\n<span class='cat-nest'>\n";
+		if ( $category['children'] ) {
+			echo "<ul>\n";
 			write_nested_categories($category['children']);
-			echo "</span>\n";
+			echo "</ul>\n";
 		}
 	}
 }
@@ -626,7 +626,7 @@
 	if ($categories) {
 		foreach ($categories as $category) {
 			if ($category->category_parent == $parent) {
-				$category->cat_name = wp_specialchars($category->cat_name);
+				$category->cat_name = wp_specialchars($category->cat_name,'double');
 				$pad = str_repeat('&#8212; ', $level);
 				if ( current_user_can('manage_categories') ) {
 					$edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>";
@@ -634,7 +634,7 @@
 					$default_link_cat_id = get_option('default_link_category');
 
 					if ( ($category->cat_ID != $default_cat_id) && ($category->cat_ID != $default_link_cat_id) )
-						$edit .= "<td><a href='categories.php?action=delete&amp;cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category &quot;%s&quot;.  All of its posts and bookmarks will go to the default categories.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete')."</a>";
+						$edit .= "<td><a href='categories.php?action=delete&amp;cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category &quot;%s&quot;.  All of its posts and bookmarks will go to the default categories.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), addslashes($category->cat_name))."' );\" class='delete'>".__('Delete')."</a>";
 					else
 						$edit .= "<td style='text-align:center'>".__("Default");
 				}
@@ -684,7 +684,7 @@
     <td><?php echo mysql2date('Y-m-d g:i a', $post->post_modified); ?></td> 
 	<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
     <td><?php if ( current_user_can('edit_page', $id) ) { echo "<a href='page.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> 
-    <td><?php if ( current_user_can('edit_page', $id) ) { echo "<a href='page.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars(get_the_title('','',0), 1)) . "' );\">" . __('Delete') . "</a>"; } ?></td> 
+    <td><?php if ( current_user_can('edit_page', $id) ) { echo "<a href='page.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), addslashes(wp_specialchars(get_the_title(),'double')) ) . "' );\">" . __('Delete') . "</a>"; } ?></td> 
   </tr> 
 
 <?php
@@ -828,19 +828,21 @@
 function list_meta($meta) {
 	global $post_ID;
 	// Exit if no meta
-	if (!$meta)
+	if (!$meta) {
+		echo '<tbody id="the-list"></tbody>'; //TBODY needed for list-manipulation JS
 		return;
+	}
 	$count = 0;
 ?>
-<table id='meta-list' cellpadding="3">
+	<thead>
 	<tr>
 		<th><?php _e('Key') ?></th>
 		<th><?php _e('Value') ?></th>
 		<th colspan='2'><?php _e('Action') ?></th>
 	</tr>
+	</thead>
 <?php
-
-
+	$r ="\n\t<tbody id='the-list'>";
 	foreach ($meta as $entry) {
 		++ $count;
 		if ($count % 2)
@@ -849,18 +851,17 @@
 			$style = '';
 		if ('_' == $entry['meta_key'] { 0 })
 			$style .= ' hidden';
-		echo "
-			<tr class='$style'>
-				<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>
-				<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>
-				<td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='".__('Update')."' /><br />
-				<input name='deletemeta[{$entry['meta_id']}]' type='submit' class='deletemeta' tabindex='6' value='".__('Delete')."' /></td>
-			</tr>
-		";
+		$entry['meta_key'] = wp_specialchars( $entry['meta_key'], true );
+		$entry['meta_value'] = wp_specialchars( $entry['meta_value'], true );
+		$r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
+		$r .= "\n\t\t<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>";
+		$r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>";
+		$r .= "\n\t\t<td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='".__('Update')."' /><br />";
+		$r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' onclick='return deleteSomething( \"meta\", {$entry['meta_id']});' class='deletemeta' tabindex='6' value='".__('Delete')."' /></td>";
+		$r .= "\n\t</tr>";
 	}
-	echo "
-		</table>
-	";
+	echo $r;
+	echo "\n\t</tbody>";
 }
 
 // Get a list of previously defined keys
@@ -886,7 +887,7 @@
 			LIMIT 10");
 ?>
 <h3><?php _e('Add a new custom field:') ?></h3>
-<table cellspacing="3" cellpadding="3">
+<table id="newmeta" cellspacing="3" cellpadding="3">
 	<tr>
 <th colspan="2"><?php _e('Key') ?></th>
 <th><?php _e('Value') ?></th>
@@ -910,13 +911,14 @@
 	</tr>
 
 </table>
-<p class="submit"><input type="submit" name="updatemeta" tabindex="9" value="<?php _e('Add Custom Field &raquo;') ?>" /></p>
+<p class="submit"><input type="submit" id="updatemetasub" name="updatemeta" tabindex="9" value="<?php _e('Add Custom Field &raquo;') ?>" /></p>
 <?php
 
 }
 
 function add_meta($post_ID) {
 	global $wpdb;
+	$post_ID = (int) $post_ID;
 
 	$metakeyselect = $wpdb->escape(stripslashes(trim($_POST['metakeyselect'])));
 	$metakeyinput = $wpdb->escape(stripslashes(trim($_POST['metakeyinput'])));
@@ -926,7 +928,7 @@
 		// We have a key/value pair. If both the select and the 
 		// input for the key have data, the input takes precedence:
 
-		if ('#NONE#' != $metakeyselect)
+ 		if ('#NONE#' != $metakeyselect)
 			$metakey = $metakeyselect;
 
 		if ($metakeyinput)
@@ -937,21 +939,32 @@
 						(post_id,meta_key,meta_value) 
 						VALUES ('$post_ID','$metakey','$metavalue')
 					");
+		return $wpdb->insert_id;
 	}
+	return false;
 } // add_meta
 
 function delete_meta($mid) {
 	global $wpdb;
+	$mid = (int) $mid;
 
-	$result = $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'");
+	return $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'");
 }
 
 function update_meta($mid, $mkey, $mvalue) {
 	global $wpdb;
+	$mid = (int) $mid;
 
 	return $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");
 }
 
+function get_post_meta_by_id($mid) {
+	global $wpdb;
+	$mid = (int) $mid;
+
+	return $wpdb->get_row("SELECT * FROM $wpdb->postmeta WHERE meta_id = '$mid'");
+}
+
 function touch_time($edit = 1, $for_post = 1) {
 	global $month, $post, $comment;
 
Index: wp-admin/edit-page-form.php
===================================================================
--- wp-admin/edit-page-form.php	(revision 3659)
+++ wp-admin/edit-page-form.php	(working copy)
@@ -6,10 +6,10 @@
 if (0 == $post_ID) {
 	$form_action = 'post';
 	$temp_ID = -1 * time();
-	$form_extra = "<input type='hidden' name='temp_ID' value='$temp_ID' />";
+	$form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
 } else {
 	$form_action = 'editpost';
-	$form_extra = "<input type='hidden' name='post_ID' value='$post_ID' />";
+	$form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
 }
 
 $sendto = $_SERVER['HTTP_REFERER'];
@@ -209,14 +209,14 @@
 <fieldset id="postcustom" class="dbx-box">
 <h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
 <div id="postcustomstuff" class="dbx-content">
+<table cellpadding="3">
 <?php 
-if($metadata = has_meta($post_ID)) {
+$metadata = has_meta($post_ID);
+list_meta($metadata); 
 ?>
+
+</table>
 <?php
-	list_meta($metadata); 
-?>
-<?php
-}
 	meta_form();
 ?>
 </div>
Index: wp-admin/admin-db.php
===================================================================
--- wp-admin/admin-db.php	(revision 3659)
+++ wp-admin/admin-db.php	(working copy)
@@ -174,7 +174,8 @@
 	$parent = $category->category_parent;
 
 	// Delete the category.
-	$wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
+	if ( !$wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'") )
+		return 0;
 
 	// Update children to point to new parent.
 	$wpdb->query("UPDATE $wpdb->categories SET category_parent = '$parent' WHERE category_parent = '$cat_ID'");
Index: wp-admin/edit-form-advanced.php
===================================================================
--- wp-admin/edit-form-advanced.php	(revision 3659)
+++ wp-admin/edit-form-advanced.php	(working copy)
@@ -21,10 +21,10 @@
 if (0 == $post_ID) {
 	$form_action = 'post';
 	$temp_ID = -1 * time();
-	$form_extra = "<input type='hidden' name='temp_ID' value='$temp_ID' />";
+	$form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
 } else {
 	$form_action = 'editpost';
-	$form_extra = "<input type='hidden' name='post_ID' value='$post_ID' />";
+	$form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
 }
 
 $form_pingback = '<input type="hidden" name="post_pingback" value="' . get_option('default_pingback_flag') . '" id="post_pingback" />';
@@ -49,7 +49,7 @@
 ?>
 
 <input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
-<input type="hidden" name="action" value="<?php echo $form_action ?>" />
+<input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" />
 <input type="hidden" name="post_author" value="<?php echo $post->post_author ?>" />
 <input type="hidden" name="post_type" value="post" />
 
@@ -72,7 +72,7 @@
 <h3 class="dbx-handle"><?php _e('Categories') ?></h3>
 <div class="dbx-content">
 <p id="jaxcat"></p>
-<div id="categorychecklist"><?php dropdown_categories(get_settings('default_category')); ?></div></div>
+<ul id="categorychecklist"><?php dropdown_categories(get_settings('default_category')); ?></ul></div>
 </fieldset>
 
 <fieldset id="commentstatusdiv" class="dbx-box">
@@ -248,16 +248,17 @@
 <fieldset id="postcustom" class="dbx-box">
 <h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
 <div id="postcustomstuff" class="dbx-content">
-<?php 
-if($metadata = has_meta($post_ID)) {
-?>
+<table cellpadding="3">
 <?php
-	list_meta($metadata); 
+$metadata = has_meta($post_ID);
+list_meta($metadata); 
 ?>
+
+</table>
 <?php
-}
 	meta_form();
 ?>
+<div id="ajax-response"></div>
 </div>
 </fieldset>
 
Index: wp-admin/categories.js
===================================================================
--- wp-admin/categories.js	(revision 0)
+++ wp-admin/categories.js	(revision 0)
@@ -0,0 +1,6 @@
+addLoadEvent(newCategoryAddIn);
+function newCategoryAddIn() {
+	if (!theList.theList) return false;
+	document.forms.addcat.submit.onclick = function(e) {return killSubmit('theList.ajaxAdder("cat", "addcat");', e); };
+	theList.clearInputs.push('cat_name','category_parent','category_description');
+}
Index: wp-admin/admin-header.php
===================================================================
--- wp-admin/admin-header.php	(revision 3659)
+++ wp-admin/admin-header.php	(working copy)
@@ -3,10 +3,13 @@
 if (!isset($_GET["page"])) require_once('admin.php');
 if ( $editing ) {
 	$dbx_js = true;
-	if ( current_user_can('manage_categories') )
+	$pmeta_js = true;
+	if ( current_user_can('manage_categories') ) {
+		$list_js = true;
 		$cat_js = true;
+	}
 }
-if ( $list_js || $cat_js )
+if ( $list_js )
 	$sack_js = true;
 ?>
 <?php get_admin_page_title(); ?>
@@ -29,8 +32,14 @@
 <script type="text/javascript" src="../wp-includes/js/tw-sack.js"></script>
 <?php } ?>
 <?php if ( $list_js ) { ?>
-<script type="text/javascript" src="list-manipulation.js"></script>
+<script type="text/javascript" src="list-manipulation-js.php"></script>
 <?php } ?>
+<?php if ( $pmeta_js ) { ?>
+<script type="text/javascript" src="custom-fields.js"></script>
+<?php } ?>
+<?php if ( 'categories.php' == $pagenow && 'edit' != $action ) { ?>
+<script type="text/javascript" src="categories.js"></script>
+<?php } ?>
 <?php if ( $dbx_js ) { ?>
 <script type="text/javascript" src="../wp-includes/js/dbx.js"></script>
 <script type="text/javascript">
Index: wp-admin/cat-js.php
===================================================================
--- wp-admin/cat-js.php	(revision 3659)
+++ wp-admin/cat-js.php	(working copy)
@@ -2,9 +2,8 @@
 require_once('../wp-config.php');
 header('Content-type: text/javascript; charset=' . get_settings('blog_charset'), true);
 ?>
-var ajaxCat = new sack();
-var newcat;
- 
+addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.clearInputs.push('newcat');});
+addLoadEvent(newCatAddIn);
 function newCatAddIn() {
 	if ( !document.getElementById('jaxcat') ) return false;
 	var ajaxcat = document.createElement('span');
@@ -16,163 +15,21 @@
 	newcat.id = 'newcat';
 	newcat.size = '16';
 	newcat.setAttribute('autocomplete', 'off');
-	newcat.onkeypress = ajaxNewCatKeyPress;
+	newcat.onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','categorydiv');", e); };
 
 	var newcatSub = document.createElement('input');
 	newcatSub.type = 'button';
 	newcatSub.name = 'Button';
 	newcatSub.id = 'catadd';
-	newcatSub.value = '<?php echo addslashes(__('Add')); ?>';
-	newcatSub.onclick = ajaxNewCat;
+	newcatSub.value = 'Add';
+	newcatSub.onclick = function() { catList.ajaxAdder('category', 'categorydiv'); };
 
 	ajaxcat.appendChild(newcat);
 	ajaxcat.appendChild(newcatSub);
 	document.getElementById('jaxcat').appendChild(ajaxcat);
 
 	howto = document.createElement('span');
-	howto.innerHTML = '<?php echo addslashes(__('Separate multiple categories with commas.')); ?>';
+	howto.innerHTML = 'Separate multiple categories with commas.';
 	howto.id = 'howto';
 	ajaxcat.appendChild(howto);
 }
-
-addLoadEvent(newCatAddIn);
-
-function getResponseElement() {
-	var p = document.getElementById('ajaxcatresponse');
-	if (!p) {
-		p = document.createElement('span');
-		document.getElementById('jaxcat').appendChild(p);
-		p.id = 'ajaxcatresponse';
-	}
-	return p;
-}
-
-function newCatLoading() {
-	var p = getResponseElement();
-	p.innerHTML = '<?php echo addslashes(__('Sending Data...')); ?>';
-}
-
-function newCatLoaded() {
-	var p = getResponseElement();
-	p.innerHTML = '<?php echo addslashes(__('Data Sent...')); ?>';
-}
-
-function newCatInteractive() {
-	var p = getResponseElement();
-	p.innerHTML = '<?php echo addslashes(__('Processing Request...')); ?>';
-}
-
-function newCatCompletion() {
-	var p = getResponseElement();
-	var id    = 0;
-	var ids   = new Array();
-	var names = new Array();
-
-	ids   = myPload( ajaxCat.response );
-	names = myPload( newcat.value );
-	for ( i = 0; i < ids.length; i++ ) {
-		id = ids[i].replace(/[\n\r]+/g, "");
-		if ( id == '-1' ) {
-			p.innerHTML = "<?php echo addslashes(__("You don't have permission to do that.")); ?>";
-			return;
-		}
-		if ( id == '0' ) {
-			p.innerHTML = "<?php echo addslashes(__('That category name is invalid.  Try something else.')); ?>";
-			return;
-		}
-
-		var exists = document.getElementById('category-' + id);
-
-		if (exists) {
-			var moveIt = exists.parentNode;
-			var container = moveIt.parentNode;
-			container.removeChild(moveIt);
-			container.insertBefore(moveIt, container.firstChild);
-			moveIt.id = 'new-category-' + id;
-			exists.checked = 'checked';
-			var nowClass = moveIt.className;
-			moveIt.className = nowClass + ' fade';
-			Fat.fade_all();
-			moveIt.className = nowClass;
-		} else {
-			var catDiv = document.getElementById('categorychecklist');
-			var newLabel = document.createElement('label');
-			newLabel.setAttribute('for', 'category-' + id);
-			newLabel.id = 'new-category-' + id;
-			newLabel.className = 'selectit fade';
-
-			var newCheck = document.createElement('input');
-			newCheck.type = 'checkbox';
-			newCheck.value = id;
-			newCheck.name = 'post_category[]';
-			newCheck.id = 'category-' + id;
-			newLabel.appendChild(newCheck);
-
-			var newLabelText = document.createTextNode(' ' + names[i]);
-			newLabel.appendChild(newLabelText);
-
-			catDiv.insertBefore(newLabel, catDiv.firstChild);
-			newCheck.checked = 'checked';
-
-			Fat.fade_all();
-			newLabel.className = 'selectit';
-		}
-		newcat.value = '';
-	}
-	p.parentNode.removeChild(p);
-//	var id = parseInt(ajaxCat.response, 10);
-}
-
-function ajaxNewCatKeyPress(e) {
-	if (!e) {
-		if (window.event) {
-			e = window.event;
-		} else {
-			return;
-		}
-	}
-	if (e.keyCode == 13) {
-		ajaxNewCat();
-		e.returnValue = false;
-		e.cancelBubble = true;
-		return false;
-	}
-}
-
-function ajaxNewCat() {
-	var newcat = document.getElementById('newcat');
-	var split_cats = new Array(1);
-	var catString = '';
-
-	catString = 'ajaxnewcat=' + encodeURIComponent(newcat.value);
-	ajaxCat.requestFile = 'edit-form-ajax-cat.php';
-	ajaxCat.method = 'GET';
-	ajaxCat.onLoading = newCatLoading;
-	ajaxCat.onLoaded = newCatLoaded;
-	ajaxCat.onInteractive = newCatInteractive;
-	ajaxCat.onCompletion = newCatCompletion;
-	ajaxCat.runAJAX(catString);
-}
-
-function myPload( str ) {
-	var fixedExplode = new Array();
-	var comma = new String(',');
-	var count = 0;
-	var currentElement = '';
-
-	for( x=0; x < str.length; x++) {
-		andy = str.charAt(x);
-		if ( comma.indexOf(andy) != -1 ) {
-			currentElement = currentElement.replace(new RegExp('^\\s*(.*?)\\s*$', ''), '$1'); // trim
-			fixedExplode[count] = currentElement;
-			currentElement = "";
-			count++;
-		} else {
-			currentElement += andy;
-		}
-	}
-
-	if ( currentElement != "" )
-		fixedExplode[count] = currentElement;
-	return fixedExplode;
-}
\ No newline at end of file
Index: wp-admin/list-manipulation-js.php
===================================================================
--- wp-admin/list-manipulation-js.php	(revision 0)
+++ wp-admin/list-manipulation-js.php	(revision 0)
@@ -0,0 +1,159 @@
+<?php
+require_once('admin.php');
+header('Content-type: text/javascript; charset=' . get_settings('blog_charset'), true);
+?>
+addLoadEvent(function(){theList=new listMan();});
+function deleteSomething(what,id,message){if(!message)message='Are you sure you want to delete this '+what+'?';if(confirm(message))return theList.ajaxDelete(what,id);else return false;}
+function dimSomething(what,id,dimClass){return theList.ajaxDimmer(what,id,dimClass);}
+
+function WPAjax(file, responseEl){//class WPAjax extends sack
+	this.getResponseElement=function(r){var p=document.getElementById(r+'-p');if(!p){p=document.createElement('span');p.id=r+'ajax-response-p';document.getElementById(r).appendChild(p);}this.myResponseElement=p;	}
+	this.parseAjaxResponse=function(){
+		if(isNaN(this.response)){this.myResponseElement.innerHTML='Error: '+this.response;return false;}
+		this.response=parseInt(this.response,10);
+		if(-1==this.response){this.myResponseElement.innerHTML="You don't have permission to do that.";return false;}
+		else if(0==this.response){this.myResponseElement.innerHTML="Something odd happened. Try refreshing the page? Either that or what you tried to change never existed in the first place.";return false;}
+		return true;
+	}
+	this.parseAjaxResponseXML=function(){
+		if(this.responseXML&&typeof this.responseXML=='object')return true;
+		if(isNaN(this.response)){this.myResponseElement.innerHTML='Error: '+this.response;return false;}
+		var r=parseInt(this.response,10);
+		if(-1==r){this.myResponseElement.innerHTML="You don't have permission to do that.";}
+		else if(0==r){this.myResponseElement.innerHTML="Invalid Entry.";}
+		return false;
+	}
+	this.init(file,responseEl);
+}	WPAjax.prototype=new sack;
+	WPAjax.prototype.init=function(f,r){
+		this.requestFile=f;this.getResponseElement(r);this.method='POST';
+		this.onLoading=function(){this.myResponseElement.innerHTML='Sending Data...';};
+		this.onLoaded=function(){this.myResponseElement.innerHTML='Data Sent...';};
+		this.onInteractive=function(){this.myResponseElement.innerHTML='Processing Data...';};
+	}
+
+function listMan(theListId){
+	this.theList=null;
+	this.ajaxRespEl=null;
+	this.inputData='';
+	this.clearInputs=new Array();
+	var reg_color='#FFFFFF';
+	var alt_color='#F1F1F1';
+	var listItems;
+	var listType;
+	self.aTrap=0;
+
+	this.ajaxAdder=function(what,where,onComplete,update){//for TR, server must wrap TR in TABLE TBODY. this.makeEl cleans it
+		if(self.aTrap)return;self.aTrap=1;setTimeout('aTrap=0',300);
+		this.ajaxAdd=new WPAjax('admin-ajax.php',this.ajaxRespEl?this.ajaxRespEl:'ajax-response');
+		if(this.ajaxAdd.failed)return true;
+		this.grabInputs(where);
+		var tempObj=this;
+		this.ajaxAdd.onCompletion=function(){
+			if(!this.parseAjaxResponseXML())return;
+			var newItems=this.responseXML.getElementsByTagName(what);
+			if(newItems){for (c=0;c<newItems.length;c++){
+				var id=parseInt(getNodeValue(newItems[c],'id'),10);
+				var exists=document.getElementById(what+'-'+id);
+				if(exists)tempObj.replaceListItem(exists.id,getNodeValue(newItems[c],'newitem'),update);
+				else tempObj.addListItem(getNodeValue(newItems[c],'newitem'));
+			}}
+			this.myResponseElement.innerHTML='';tempObj.inputData='';
+			for(var i=0;i<tempObj.clearInputs.length;i++){try{var theI=document.getElementById(tempObj.clearInputs[i]);if(theI.tagName.match(/select/i))theI.selectedIndex=0;else theI.value='';}catch(e){}}
+			if(onComplete&&typeof onComplete=='function')onComplete();
+		}
+		this.ajaxAdd.runAJAX('action='+(update?'update-':'add-')+what+this.inputData);
+		return false;
+	}
+	this.ajaxUpdater=function(what,where,onComplete){return this.ajaxAdder(what,where,onComplete,true);}
+	this.ajaxDelete=function(what,id,onComplete){
+		if(self.aTrap)return;self.aTrap=1;setTimeout('aTrap=0',300);
+		this.ajaxDel=new WPAjax('admin-ajax.php',this.ajaxRespEl?this.ajaxRespEl:'ajax-response');
+		if(this.ajaxDel.failed)return true;
+		var tempObj=this;
+		this.ajaxDel.onCompletion=function(){if(this.parseAjaxResponse()){tempObj.removeListItem(what.replace('-as-spam','')+'-'+id,tempObj);this.myResponseElement.innerHTML='';if(onComplete&&typeof onComplete=='function')onComplete();}};
+		this.ajaxDel.runAJAX('action=delete-'+what+'&id='+id);
+		return false;
+	}
+	this.ajaxDimmer=function(what,id,dimClass,onComplete){
+		if(self.aTrap)return;self.aTrap=1;setTimeout('aTrap=0',300);
+		this.ajaxDim=new WPAjax('admin-ajax.php',this.ajaxRespEl?this.ajaxRespEl:'ajax-response');
+		if(this.ajaxDim.failed)return true;
+		var tempObj=this;
+		this.ajaxDim.onCompletion=function(){if(this.parseAjaxResponse()){tempObj.dimItem(what+'-'+id,dimClass);this.myResponseElement.innerHTML='';if(onComplete&&typeof onComplete=='function')onComplete();}};
+		this.ajaxDim.runAJAX('action=dim-'+what+'&id='+id);
+		return false;
+	}
+	this.makeEl=function(h){var fakeItem=document.createElement('div');fakeItem.innerHTML=h;var r=fakeItem.firstChild;while(r.tagName.match(/(table|tbody)/i)){r=r.firstChild;}return r;}
+	this.addListItem=function(h){
+		newItem=this.makeEl(h);
+		var firstItem=this.theList.getElementsByTagName('table'==listType?'tr':'li')[0];
+		if(firstItem)firstItem.parentNode.insertBefore(newItem,firstItem);
+		else this.theList.appendChild(newItem);
+		listItems.unshift(newItem.id);
+		Fat.fade_element(newItem.id);
+	}
+	this.removeListItem=function(id,listObj,noFade){
+		if(!listObj)listObj=this;
+		if(!noFade)Fat.fade_element(id,null,700,'#FF3333');
+		var theItem=document.getElementById(id);
+		if(!noFade){var func=encloseFunc(function(a){a.parentNode.removeChild(a);},theItem);setTimeout(func,705);}
+		else{theItem.parentNode.removeChild(theItem);}
+		var pos=listObj.getListPos(id);
+		listItems.splice(pos,1);
+		if(!noFade)listObj.recolorList(pos,1000);
+	}
+	this.replaceListItem=function(id,h,update){
+		if(!update){this.removeListItem(id,false,true);this.addListItem(h);return;}
+		var newItem=this.makeEl(h);
+		var oldItem=document.getElementById(id);
+		oldItem.parentNode.replaceChild(newItem,oldItem);
+		Fat.fade_element(newItem.id);
+	}
+	this.dimItem=function(id,dimClass,noFade){
+		var theItem=document.getElementById(id);
+		if(theItem.className.match(dimClass)){if(!noFade)Fat.fade_element(id,null,700,null);theItem.className=theItem.className.replace(dimClass,'');}
+		else{if(!noFade)Fat.fade_element(id,null,700,'#FF3333');theItem.className=theItem.className+' '+dimClass;}
+	}
+	this.grabInputs=function(elId){//text,password,hidden,textarea,select
+		var theItem=document.getElementById(elId);
+		var inputs=new Array();
+		inputs.push(theItem.getElementsByTagName('input'),theItem.getElementsByTagName('textarea'),theItem.getElementsByTagName('select'));
+		for(var a=0;a<inputs.length;a++){
+			for(var i=0;i<inputs[a].length;i++){
+				if('action'==inputs[a][i].name)continue;
+				if('text'==inputs[a][i].type||'password'==inputs[a][i].type||'hidden'==inputs[a][i].type||inputs[a][i].tagName.match(/textarea/i)){
+					this.inputData+='&'+inputs[a][i].name+'='+encodeURIComponent(inputs[a][i].value);
+				}else if(inputs[a][i].tagName.match(/select/i)){
+					this.inputData+='&'+inputs[a][i].name+'='+encodeURIComponent(inputs[a][i].options[inputs[a][i].selectedIndex].value);
+				}
+			}	
+		}
+	}
+	this.getListPos=function(id){for(var i=0;i<listItems.length;i++){if(id==listItems[i]){var pos=i;break;}}return pos;}
+	this.getListItems=function(){
+		if(this.theList)return;
+		listItems=new Array();
+		if(theListId){this.theList=document.getElementById(theListId);if(!this.theList)return false;}
+		else{this.theList=document.getElementById('the-list');if(this.theList)theListId='the-list';}
+		if(this.theList){
+			var items=this.theList.getElementsByTagName('tr');listType='table'
+			if(!items[0]){items=this.theList.getElementsByTagName('li');listType='list'}
+			for(var i=0;i<items.length;i++){listItems.push(items[i].id);}
+		}
+	}
+	this.recolorList=function(pos,dur){
+		if(!pos)pos=0;
+		for(var i=pos;i<listItems.length;i++){var e=document.getElementById(listItems[i]);if(i%2)e.className=e.className.replace('alternate','fade-'+alt_color.slice(1));else e.className+=' alternate fade-'+reg_color.slice(1);e.style.backgroundColor='';}
+		Fat.fade_all(dur);
+		var func=encloseFunc(function(l){for(var i=0;i<l.length;i++){var e=document.getElementById(l[i]);e.className=e.className.replace(/fade-[a-f0-9]{6}/i,'');}},listItems);
+		setTimeout(func,dur+5);
+	}
+	this.getListItems();
+}
+//No submit unless eval(code) returns true.
+function killSubmit(code,e){if(!e){if(window.event)e=window.event;else return;}var t=e.target?e.target:e.srcElement;if(('text'==t.type&&e.keyCode==13)||('submit'==t.type&&'click'==e.type)){if(!eval(code));e.returnValue=false;e.cancelBubble=true;return false;}}
+//Pretty func from ALA http://www.alistapart.com/articles/gettingstartedwithajax
+function getNodeValue(tree,el){return tree.getElementsByTagName(el)[0].firstChild.nodeValue;}
+//Generic but lame JS closure
+function encloseFunc(f){var a=arguments[1];return function(){f(a);}}
Index: wp-admin/edit.php
===================================================================
--- wp-admin/edit.php	(revision 3659)
+++ wp-admin/edit.php	(working copy)
@@ -114,7 +114,6 @@
 <br style="clear:both;" />
 
 <?php
-
 // define the columns to display, the syntax is 'internal name' => 'display name'
 $posts_columns = array(
   'id'         => __('ID'),
@@ -133,7 +132,8 @@
 
 ?>
 
-<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3"> 
+<table width="100%" cellpadding="3" cellspacing="3"> 
+	<thead>
 	<tr>
 
 <?php foreach($posts_columns as $column_display_name) { ?>
@@ -141,10 +141,13 @@
 <?php } ?>
 
 	</tr>
+	</thead>
+	<tbody id="the-list">
 <?php
 if ($posts) {
 $bgcolor = '';
 foreach ($posts as $post) { start_wp();
+add_filter('the_title','wp_specialchars');
 $class = ('alternate' == $class) ? '' : 'alternate';
 ?> 
 	<tr id='post-<?php echo $id; ?>' class='<?php echo $class; ?>'>
@@ -207,7 +210,7 @@
 
 	case 'control_delete':
 		?>
-		<td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . sprintf(__("You are about to delete this post &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars(get_the_title('', ''), 1) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
+		<td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . sprintf(__("You are about to delete this post &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), addslashes(wp_specialchars(get_the_title(),'double')) ) . "' );\">" . __('Delete') . "</a>"; } ?></td>
 		<?php
 		break;
 
@@ -229,7 +232,8 @@
   </tr> 
 <?php
 } // end if ($posts)
-?> 
+?>
+	</tbody>
 </table>
 
 <div id="ajax-response"></div>
@@ -246,26 +250,26 @@
 	if ($comments) {
 	?> 
 <h3><?php _e('Comments') ?></h3> 
-<ol id="comments"> 
+<ol id="the-list"> 
 <?php
+$i = 0;
 foreach ($comments as $comment) {
-$comment_status = wp_get_comment_status($comment->comment_ID);
+$class = ( ++$i % 2 ) ? array('alternate') : array();
+if ( 'unapproved' == $comment_status = wp_get_comment_status($comment->comment_ID) )
+	$class[] = 'unapproved';
 ?> 
 
-<li <?php if ("unapproved" == $comment_status) echo "class='unapproved'"; ?> >
+<li id='comment-<?php echo $comment->comment_ID; ?>'<?php if ( $class ) echo " class='" . join(' ', $class) . "'"; ?>>
   <?php comment_date('Y-n-j') ?> 
   @
   <?php comment_time('g:m:s a') ?> 
   <?php 
 			if ( current_user_can('edit_post', $post->ID) ) {
-				echo "[ <a href=\"post.php?action=editcomment&amp;comment=".$comment->comment_ID."\">" .  __('Edit') . "</a>";
-				echo " - <a href=\"post.php?action=deletecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n  \'OK\' to delete, \'Cancel\' to stop."), $comment->comment_author) . "')\">" . __('Delete') . "</a> ";
+				echo "[ <a href='post.php?action=editcomment&amp;comment=".$comment->comment_ID."\'>" .  __('Edit') . '</a>';
+				echo ' - <a href="post.php?action=deletecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), wp_specialchars($comment->comment_author, 1)) . "' );\">" . __('Delete') . '</a> ';
 				if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
-					if ('approved' == wp_get_comment_status($comment->comment_ID)) {
-						echo " - <a href=\"post.php?action=unapprovecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">" . __('Unapprove') . "</a> ";
-					} else {
-						echo " - <a href=\"post.php?action=approvecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">" . __('Approve') . "</a> ";
-					}
+					echo '<span class="unapprove"> - <a href="comment.php?action=unapprovecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\' );">' . __('Unapprove') . '</a> </span>';
+					echo '<span class="approve"> - <a href="comment.php?action=approvecomment&amp;p=' . $post->ID . '&amp;comment=' . $comment->comment_ID . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\' );">' . __('Approve') . '</a> </span>';
 				}
 				echo "]";
 			} // end if any comments to show
Index: wp-admin/list-manipulation.js
===================================================================
--- wp-admin/list-manipulation.js	(revision 3659)
+++ wp-admin/list-manipulation.js	(working copy)
@@ -1,96 +0,0 @@
-var listItems;
-var reg_color = '#FFFFFF';
-var alt_color = '#F1F1F1';
-
-addLoadEvent(getListItems);
-
-function deleteSomething( what, id, message ) {
-	what.replace('-', ' ');
-	if (!message) message = 'Are you sure you want to delete this ' + what + '?';
-	if ( confirm(message) ) {
-		return ajaxDelete( what.replace(' ', '-'), id );
-	} else {
-		return false;
-	}
-}
-
-function getResponseElement() {
-	var p = document.getElementById('ajax-response-p');
-	if (!p) {
-		p = document.createElement('p');
-		p.id = 'ajax-response-p';
-		document.getElementById('ajax-response').appendChild(p);
-		return p;
-	}
-}
-
-function ajaxDelete(what, id) {
-	ajaxDel = new sack('list-manipulation.php');
-	if ( ajaxDel.failed ) return true;
-	ajaxDel.myResponseElement = getResponseElement();
-	ajaxDel.method = 'POST';
-	ajaxDel.onLoading = function() { ajaxDel.myResponseElement.innerHTML = 'Sending Data...'; };
-	ajaxDel.onLoaded = function() { ajaxDel.myResponseElement.innerHTML = 'Data Sent...'; };
-	ajaxDel.onInteractive = function() { ajaxDel.myResponseElement.innerHTML = 'Processing Data...'; };
-	ajaxDel.onCompletion = function() { removeThisItem( what.replace('-as-spam', '') + '-' + id ); };
-	ajaxDel.runAJAX('action=delete-' + what + '&id=' + id);
-	return false;
-}
-
-function removeThisItem(id) {
-	var response = ajaxDel.response;
-	if ( isNaN(response) ) { alert(response); }
-	response = parseInt(response, 10);
-	if ( -1 == response ) { ajaxDel.myResponseElement.innerHTML = "You don't have permission to do that."; }
-	else if ( 0 == response ) { ajaxDel.myResponseElement.interHTML = "Something odd happened.  Try refreshing the page? Either that or what you tried to delete never existed in the first place."; }
-	else if ( 1 == response ) {
-		theItem = document.getElementById(id);
-		Fat.fade_element(id,null,700,'#FF3333');
-		setTimeout('theItem.parentNode.removeChild(theItem)', 705);
-		var pos = getListPos(id);
-		listItems.splice(pos,1);
-		recolorList(pos);
-		ajaxDel.myResponseElement.parentNode.removeChild(ajaxDel.myResponseElement);
-
-	}
-}
-
-function getListPos(id) {
-	for (var i = 0; i < listItems.length; i++) {
-		if (id == listItems[i]) {
-			var pos = i;
-			break;
-		}
-	}
-	return pos;
-}
-
-function getListItems() {
-	if (list) return;
-	listItems = new Array();
-	var extra = false;
-	var list = document.getElementById('the-list');
-	if (!list) { var list = document.getElementById('the-list-x'); extra = true; }
-	if (list) {
-		var items = list.getElementsByTagName('tr');
-		if (!items[0]) { items = list.getElementsByTagName('li'); }
-		for (var i=0; i<items.length; i++) { listItems.push(items[i].id); }
-		if (extra) { listItems.splice(0,1); }
-	}
-}
-
-function recolorList(pos,dur,from) {
-	if (!pos) pos = 0;
-
-	if (!from) {
-		reg_from = alt_color;
-		alt_from = reg_color;
-	} else {
-		reg_from = from;
-		alt_from = from;
-	}
-	for (var i = pos; i < listItems.length; i++) {
-		if (i % 2 == 1) Fat.fade_element(listItems[i],null,dur,reg_from,reg_color);
-		else Fat.fade_element(listItems[i],null,dur,alt_from,alt_color);
-	}
-}
Index: wp-admin/link-manager.php
===================================================================
--- wp-admin/link-manager.php	(revision 3659)
+++ wp-admin/link-manager.php	(working copy)
@@ -114,7 +114,8 @@
 <input type="hidden" name="action" value="" />
 <input type="hidden" name="order_by" value="<?php echo wp_specialchars($order_by, 1); ?>" />
 <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
-<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
+<table width="100%" cellpadding="3" cellspacing="3">
+	<thead>
 	<tr>
 		<th width="15%"><?php _e('Name') ?></th>
 		<th><?php _e('URI') ?></th>
@@ -124,6 +125,8 @@
 		<th colspan="2"><?php _e('Action') ?></th>
 		<th><input type="checkbox" onclick="checkAll(document.getElementById('links'));" /></th>
 	</tr>
+	</thead>
+	<tbody id="the-list">
 <?php
 if ( 'all' == $cat_id )
 	$cat_id = '';
@@ -174,6 +177,7 @@
 		echo "\n    </tr>\n";
 	}
 ?>
+	</tbody>
 </table>
 
 <div id="ajax-response"></div>
@@ -182,4 +186,4 @@
 </div>
 </form>
 
-<?php include('admin-footer.php'); ?>
\ No newline at end of file
+<?php include('admin-footer.php'); ?>
Index: wp-admin/edit-pages.php
===================================================================
--- wp-admin/edit-pages.php	(revision 3659)
+++ wp-admin/edit-pages.php	(working copy)
@@ -28,20 +28,24 @@
 
 if ($posts) {
 ?>
-<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3"> 
-  <tr> 
-    <th scope="col"><?php _e('ID') ?></th> 
-    <th scope="col"><?php _e('Title') ?></th> 
+<table width="100%" cellpadding="3" cellspacing="3"> 
+  <thead>
+  <tr>
+    <th scope="col"><?php _e('ID') ?></th>
+    <th scope="col"><?php _e('Title') ?></th>
     <th scope="col"><?php _e('Owner') ?></th>
 	<th scope="col"><?php _e('Updated') ?></th>
-	<th scope="col"></th> 
-    <th scope="col"></th> 
-    <th scope="col"></th> 
-  </tr> 
+	<th scope="col"></th>
+    <th scope="col"></th>
+    <th scope="col"></th>
+  </tr>
+  </thead>
+  <tbody id="the-list">
 <?php
 page_rows(0, 0, $posts, $all);
 ?>
-</table> 
+  </tbody>
+</table>
 
 <div id="ajax-response"></div>
 
Index: wp-admin/categories.php
===================================================================
--- wp-admin/categories.php	(revision 3659)
+++ wp-admin/categories.php	(working copy)
@@ -3,7 +3,6 @@
 
 $title = __('Categories');
 $parent_file = 'edit.php';
-$list_js = true;
 
 $wpvarstoreset = array('action','cat');
 for ($i=0; $i<count($wpvarstoreset); $i += 1) {
@@ -104,6 +103,7 @@
 
 default:
 
+$list_js = true;
 require_once ('admin-header.php');
 
 $messages[1] = __('Category added.');
@@ -121,7 +121,8 @@
 <?php else : ?>
 	<h2><?php _e('Categories') ?> </h2>
 <?php endif; ?>
-<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3">
+<table width="100%" cellpadding="3" cellspacing="3">
+	<thead>
 	<tr>
 		<th scope="col"><?php _e('ID') ?></th>
         <th scope="col"><?php _e('Name') ?></th>
@@ -130,9 +131,12 @@
         <th scope="col"><?php _e('# Bookmarks') ?></th>
         <th colspan="2"><?php _e('Action') ?></th>
 	</tr>
+	</thead>
+	<tbody id="the-list">
 <?php
 cat_rows();
 ?>
+	</tbody>
 </table>
 
 <div id="ajax-response"></div>
@@ -149,14 +153,14 @@
     <form name="addcat" id="addcat" action="categories.php" method="post">
         
         <p><?php _e('Name:') ?><br />
-        <input type="text" name="cat_name" value="" /></p>
+        <input type="text" name="cat_name" id="cat_name" value="" /></p>
         <p><?php _e('Category parent:') ?><br />
-        <select name='category_parent' class='postform'>
+        <select name='category_parent' id='category_parent' class='postform'>
         <option value='0'><?php _e('None') ?></option>
         <?php wp_dropdown_cats(0); ?>
         </select></p>
         <p><?php _e('Description: (optional)') ?> <br />
-        <textarea name="category_description" rows="5" cols="50" style="width: 97%;"></textarea></p>
+        <textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"></textarea></p>
         <p class="submit"><input type="hidden" name="action" value="addcat" /><input type="submit" name="submit" value="<?php _e('Add Category &raquo;') ?>" /></p>
     </form>
 </div>
