<!-- begin sidebar -->
<div id="menu">
<ul>

<li id="categories"><div class="menutitle"><?php _e('Categories:'); ?></div>
    <ul>
<?php wp_list_cats('sort_column=name&optioncount=1&exclude=10, 15'); ?>
    </ul>
</li>

<li id="search">
   <div class="menutitle"><?php _e('Search:'); ?></div>
   <form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <div>
        <input type="text" name="s" id="s" size="15" /><br />
        <input type="submit" name="submit" value="<?php _e('Search'); ?>" />
    </div>
    </form>
</li>
<li id="meta"><div class="menutitle"><?php _e('Meta:'); ?></div>
    <ul>  <!-- UL 2 debut -->
        <?php wp_register(); ?>
        <li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php _e('Syndicate this site using RSS'); ?>"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
        <li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php _e('The latest comments to all posts in RSS'); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
        <li><a href="http://validator.w3.org/check/referer" title="<?php _e('This page validates as XHTML 1.0 Transitional'); ?>"><?php _e('Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr>'); ?></a></li>
        <li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li>
        <li><a href="http://wordpress.org/" title="<?php _e('Powered by WordPress, state-of-the-art semantic personal publishing platform.'); ?>"><abbr title="WordPress">WP</abbr></a></li>
    </ul>
</li>

</ul>
<br />
<?php get_calendar();?>
</div>

<div class="clearer">&nbsp;</div>

</div>

<div id="rmenu">
<ul>
<?php
$today 
current_time('mysql'1);

if ( 
$recentposts $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5")): ?>
<li id="recents"><div class="menutitle"><?php _e("Recent Posts"); ?></div>
<ul>
<?php
foreach ($recentposts as $post) {
        if (
$post->post_title == '')
                
$post->post_title sprintf(__('Post #%s'), $post->ID); ?>
        <li><a href="<?php echo get_permalink($post->ID); ?>"><?php the_title(); ?></a></li>
<?php ?>
</ul>
</li>
<?php endif; ?>

<?php
global $comment;

if ( 
$comments $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments ORDER BY comment_date_gmt DESC LIMIT 5") ) :
?>

<li id="lastcomments"><div class="menutitle"><?php _e('Comments');
?></div>
<ul>
<?php
foreach ($comments as $comment) {
  echo 
'<li>' sprintf('%s <span style="text-transform: lowercase;">on</span><br />%s'get_comment_author_link(), '<a href="'get_permalink($comment->comment_post_ID) . '#comment-' $comment->comment_ID '">' get_the_title($comment->comment_post_ID) . '</a>');
  echo 
'</li>';
}
?>
</ul>
</li>
<?php endif; ?>

<?php /* Start of links list code. */ ?>

<li id="links"><div class="menutitle"><?php _e("Safe for Work Links")?></div>
<?php
$link_cats 
$wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
foreach(
$link_cats as $link_cat) {
    if((
$link_cat->cat_name != 'Dating') && ($link_cat->cat_name != 'Gross') && ($link_cat->cat_name != 'Sex')) { ?>
<li id="linkcat-<?php echo $link_cat->cat_id?>"><h2><?php echo $link_cat->cat_name?></h2>
    <ul>
    <?php wp_get_links($link_cat->cat_id); ?>
    </ul>
</li>
<?php } } ?>
    
<li id="links"><div class="menutitle"><?php _e("NOT Safe for Work Links")?></div>
<?php
$link_cats 
$wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
foreach(
$link_cats as $link_cat) {
    if((
$link_cat->cat_name != 'Humor') && ($link_cat->cat_name != 'News') && ($link_cat->cat_name != 'Finance')) { ?>
<li id="linkcat-<?php echo $link_cat->cat_id?>"><h2><?php echo $link_cat->cat_name?></h2>
    <ul>
    <?php wp_get_links($link_cat->cat_id); ?>
    </ul>
</li>
<?php } } ?>

<?php /* End of links list code  */ ?>

<li id="archives"><div class="menutitle"><?php _e('Archives:'); ?></div>
    <ul>
     <?php wp_get_archives('type=monthly'); ?>
    </ul>
</li>

</li>
</ul>

</div>

<div class="clearer">&nbsp;</div>
<!-- end sidebar -->