Index: post-template.php
===================================================================
--- post-template.php	(revision 14487)
+++ post-template.php	(working copy)
@@ -536,23 +536,26 @@
  * Quicktag one or more times). This tag must be within The Loop.
  *
  * The defaults for overwriting are:
+ * 'before' - Default is '<p> Pages:' (string). The html or text to prepend to
+ *      each bookmarks.
+ * 'after' - Default is '</p>' (string). The html or text to append to each
+ *      bookmarks.
+ * 'link_before' - Default is '' (string). The html or text to prepend to each
+ *      Pages link inside the <a> tag.
+ * 'link_after' - Default is '' (string). The html or text to append to each
+ *      Pages link inside the <a> tag.
  * 'next_or_number' - Default is 'number' (string). Indicates whether page
  *      numbers should be used. Valid values are number and next.
  * 'nextpagelink' - Default is 'Next Page' (string). Text for link to next page.
  *      of the bookmark.
+ * 'separator' - Default is ' ' (string). Text used only between numbers.
  * 'previouspagelink' - Default is 'Previous Page' (string). Text for link to
  *      previous page, if available.
  * 'pagelink' - Default is '%' (String).Format string for page numbers. The % in
  *      the parameter string will be replaced with the page number, so Page %
  *      generates "Page 1", "Page 2", etc. Defaults to %, just the page number.
- * 'before' - Default is '<p> Pages:' (string). The html or text to prepend to
- *      each bookmarks.
- * 'after' - Default is '</p>' (string). The html or text to append to each
- *      bookmarks.
- * 'link_before' - Default is '' (string). The html or text to prepend to each
- *      Pages link inside the <a> tag.
- * 'link_after' - Default is '' (string). The html or text to append to each
- *      Pages link inside the <a> tag.
+ * 'echo' - Default is 1 (integer). When not 0, this triggers the text to be 
+ *		echoed as well as returned.
  *
  * @since 1.2.0
  * @access private
@@ -562,10 +565,15 @@
  */
 function wp_link_pages($args = '') {
 	$defaults = array(
-		'before' => '<p>' . __('Pages:'), 'after' => '</p>',
-		'link_before' => '', 'link_after' => '',
-		'next_or_number' => 'number', 'nextpagelink' => __('Next page'),
-		'previouspagelink' => __('Previous page'), 'pagelink' => '%',
+		'before' => '<p>' . __('Pages:'), 
+		'after' => '</p>',
+		'link_before' => '', 
+		'link_after' => '',
+		'next_or_number' => 'number', 
+		'nextpagelink' => __('Next page'),
+		'separator' => ' ',
+		'previouspagelink' => __('Previous page'), 
+		'pagelink' => '%',
 		'echo' => 1
 	);
 
@@ -581,57 +589,61 @@
 			$output .= $before;
 			for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) {
 				$j = str_replace('%',$i,$pagelink);
-				$output .= ' ';
+				if ($output != $before) {
+					$output .= $separator;
+				}
 				if ( ($i != $page) || ((!$more) && ($page==1)) ) {
 					if ( 1 == $i ) {
-						$output .= '<a href="' . get_permalink() . '">';
+						$output .= '<a class="pag_nav_num pag_nav_first" href="' . get_permalink() . '">';
 					} else {
 						if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
-							$output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">';
+							$output .= '<a  class="pag_nav_num" href="' . add_query_arg('page', $i, get_permalink()) . '">';
 						elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
-							$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">';
+							$output .= '<a  class="pag_nav_num" href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">';
 						else
-							$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
+							$output .= '<a  class="pag_nav_num' . ($i >= $numpages ? ' pag_nav_last':'')  . '" href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
 					}
-
+				} else {
+					$output .= '<span class="pag_nav_num pag_nav_current' . ($i <= 1 ? ' pag_nav_first':($i >= $numpages ? ' pag_nav_last':''))  . '">';
 				}
 				$output .= $link_before;
 				$output .= $j;
 				$output .= $link_after;
-				if ( ($i != $page) || ((!$more) && ($page==1)) )
+				if ( ($i != $page) || ((!$more) && ($page==1)) ) {
 					$output .= '</a>';
+				} else {
+					$output .= '</span>';
+				}
 			}
 			$output .= $after;
 		} else {
 			if ( $more ) {
 				$output .= $before;
 				$i = $page - 1;
-				if ( $i && $more ) {
+				if ( ($i > 0) && $more && ($previouspagelink != "")) {
 					if ( 1 == $i ) {
-						$output .= '<a href="' . get_permalink() . '">';
+						$output .= '<a class="pag_nav_prev pag_nav_first" href="' . get_permalink() . '">' . $link_before . $previouspagelink . $link_after . '</a>';
 					} else {
 						if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
-							$output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">';
+							$output .= '<a class="pag_nav_prev" href="' . add_query_arg('page', $i, get_permalink()) . '">' . $link_before . $previouspagelink . $link_after . '</a>';
 						elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
-							$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">';
+							$output .= '<a class="pag_nav_prev" href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">';
 						else
-							$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
+							$output .= '<a class="pag_nav_prev" href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $previouspagelink . $link_after . '</a>';
 					}
-					$output .= $link_before. $previouspagelink . $link_after . '</a>';
 				}
 				$i = $page + 1;
-				if ( $i <= $numpages && $more ) {
+				if ( ($i <= $numpages) && $more && ($nextpagelink != "")) {
 					if ( 1 == $i ) {
-						$output .= '<a href="' . get_permalink() . '">';
+						$output .= '<a class="pag_nav_next first" href="' . get_permalink() . '">' . $link_before . $nextpagelink . $link_after . '</a>';
 					} else {
 						if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
-							$output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">';
+							$output .= '<a class="pag_nav_next" href="' . add_query_arg('page', $i, get_permalink()) . '">' . $link_before . $nextpagelink . $link_after . '</a>';
 						elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
-							$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">';
+							$output .= '<a class="pag_nav_next"  href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">';
 						else
-							$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
+							$output .= '<a class="pag_nav_next" href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $nextpagelink . $link_after . '</a>';
 					}
-					$output .= $link_before. $nextpagelink . $link_after . '</a>';
 				}
 				$output .= $after;
 			}
