	<div id="sidebar">
	    <table id="sidebar-column-layout">
		<tr>

		<td id="sidebar-col1" class="sidebar-column">

		<?php include (TEMPLATEPATH . '/paypaltile.php'); ?>

		<h2 id="heading-about-this-page">About this page</h2>

		<?php
			/* this function overrides because is_404 is false when using Apache ErrorDocument */ 
			function is_special_page() { return isset($_GET['showpage']); }
			function is_master_archive() { return is_special_page() && $_GET['showpage'] == 'archives'; }
			function is_dir_index() { return is_special_page() && $_GET['showpage'] == 'directoryindex'; }
			function is_error_page() { return (is_404() || isset($_GET["httperror"])); }
			function is_useronline() { global $bots; global $usersonline; return isset($bots) && isset($usersonline); }
			/* this function overrides because is_single is true on error pages */ 
			function is_really_single() { return is_single() && !is_error_page(); }
		?>
		<?php /* If this is a 404 page */ if (is_error_page()) { ?>
		<p>This is a server-generated error page at the <a href="<?php echo get_settings('siteurl'); ?>"><?php bloginfo('name'); ?></a>.</p><div><?php global $httperrormessage; echo $httperrormessage; ?></div>
		<?php /* If this is a single post */ } elseif (is_really_single()) { ?>
		<p><?php if (function_exists('jp_bct')) { jp_bct($root='/', $showhome=TRUE, $before='<span id="bct">This is ',$after="</span>",$divider=" &raquo; ",$eachlink='<a href="%url%" title="Browse to: %name%">%name%</a>',$current="<em>%name%</em>",$homename=get_settings('blogname')); echo " &ndash; "; } else { ?>You are currently reading <?php } ?> an <a href="<?php bloginfo('wpurl'); ?>/archives/">archived</a> article from <a href="<?php echo get_settings('siteurl'); ?>"><?php bloginfo('name'); ?></a>.</p>

		<?php /* If this is a category archive */ } elseif (is_category()) { ?>
		<p>You are currently browsing the <a href="<?php bloginfo('wpurl'); ?>/archives/">archives</a> for the <?php single_cat_title(''); ?> category.</p>
		
		<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
		<p>You are currently browsing <a href="<?php echo get_settings('siteurl'); ?>"><?php bloginfo('name'); ?></a> weblog <a href="<?php bloginfo('wpurl'); ?>/archives/">archives</a>
		for the day <?php the_time('l, F jS, Y'); ?>.</p>
		
		<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
		<p>You are currently browsing <a href="<?php echo get_settings('siteurl'); ?>"><?php bloginfo('name'); ?></a> weblog <a href="<?php bloginfo('wpurl'); ?>/archives/">archives</a>
		for <?php the_time('F, Y'); ?>.</p>


		<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
		<p>You are currently browsing <a href="<?php echo get_settings('siteurl'); ?>"><?php bloginfo('name'); ?></a> weblog <a href="<?php bloginfo('wpurl'); ?>/archives/">archives</a>
		for the year <?php the_time('Y'); ?>.</p>

		
		<?php /* If this is a search result */ } elseif (is_search()) { ?>
		<p>You have searched <a href="<?php echo get_settings('siteurl'); ?>"><?php bloginfo('name'); ?></a> weblog <a href="<?php bloginfo('wpurl'); ?>/archives/">archives</a>
		for <strong>'<?php echo wp_specialchars($s); ?>'</strong>. If you are unable to find anything in these search results, you should try one of the hyperlinks in this sidebar.</p>

		<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
		<p>You are currently browsing <a href="<?php echo get_settings('siteurl'); ?>"><?php bloginfo('name'); ?></a> weblog <a href="<?php bloginfo('wpurl'); ?>/archives/">archives</a>.</p>

		<?php /* If this is the archives master page */ } elseif (is_master_archive()) { ?>
		<p>You are currently viewing the complete <a href="<?php bloginfo('wpurl'); ?>/archives/">archives</a> for <a href="<?php echo get_settings('siteurl'); ?>"><?php bloginfo('name'); ?></a>.</p>

		<?php /* If this is the archives master page */ } elseif (is_dir_index()) { ?>
		<p>You are currently viewing the contents of a folder in <a href="<?php echo get_settings('siteurl'); ?>"><?php bloginfo('name'); ?></a>.</p>

		<?php /* If this is a page, not a post */ } elseif (is_page()) { ?>
			<p><?php if (function_exists('jp_bct')) { jp_bct($root='/', $showhome=TRUE, $before='<span id="bct">This is ',$after="</span>",$divider=" &raquo; ",$eachlink='<a href="%url%" title="Browse to: %name%">%name%</a>',$current="<em>%name%</em>",$homename=get_settings('blogname')); echo " &ndash; "; } else { ?>You are currently reading <?php } ?> a Web page in <a href="<?php echo get_settings('siteurl'); ?>"><?php echo bloginfo('name'); ?></a>.</p>
			
			<?php
			ob_start();
			global $id;
			if (function_exists("wswwpx_fold_page_list")) {
				wswwpx_fold_page_list("title_li=&sort_column=menu_order&child_of=$id");
				} else {
				wp_list_pages("title_li=&sort_column=menu_order&child_of=$id" );
			}
			$subpages = trim(ob_get_contents());
			ob_end_clean();
			?>
			<?php if ($subpages) { ?>
				<p>This page contains the following pages:</p>
				<ul><?php print $subpages; ?></ul>
			<?php } else {?>
			<?php } ?>
	
		<?php /* If this is the front page */ } else { ?>
		<p>You are reading <a href="<?php echo get_settings('siteurl'); ?>"><?php echo bloginfo('name'); ?></a>: my personal Weblog<?php if (function_exists("days_since_birth")) { ?>, created <?php days_since_birth() ?> days ago<?php } ?>.  I write about technology, life, women, music, philosophy and politics.  Sometimes I also write about me.
		</p>
		<?php } ?>

		<?php if (is_really_single()) { ?>
		<p><?php previous_post_link('The previous post is %link.') ?> <?php next_post_link('The next post is %link.') ?></p>
		<?php /* only if this is not search, because that case's covered down - we are also overriding the older entries / newer entries navigation if this is a "showpage" page (generally the master archive page or a directory index page) */ } elseif (!is_search() && !is_error_page() && !is_special_page() && !is_useronline()) { ?>
		<div class="navigation"><div class="previous"><?php next_posts_link('&laquo; Older entries') ?></div><div class="next"><?php previous_posts_link('Newer entries &raquo;') ?></div></div>
		<?php } ?>

		<?php include (TEMPLATEPATH . '/searchform.php'); ?>
		<?php /* If this is search */ if (is_search()) { ?>
		<div class="navigation"><div class="previous"><?php next_posts_link('&laquo; Older results') ?></div><div class="next"><?php previous_posts_link('Newer results &raquo;') ?></div></div>
		<?php } ?>

		<h2 id="heading-pages">Pages</h2>
		<ul class="boxmeup">
			<?php wp_list_pages('title_li=&sort_column=menu_order&depth=2' ); ?>
		</ul>

		<h2 id="heading-archives">Archives</h2>
		<div id="archives">
		<?php if (!is_dir_index()) get_calendar(1); ?> 
		<div><a href="<?php bloginfo('wpurl'); ?>/archives/">Complete archives</a></div>
		</div>
		
		<?php if (function_exists("the_subscribe_links")) { ?>
		<?php define('sem_subscribe_me_displayed', true); // nice hack! ?>
		<?php } ?>

		<?php /* If this is the frontpage or is a web page (not post) */ if ( 1 || is_home() || is_page() ) { ?>
		<h2 id="heading-about-this-site">About <?php bloginfo('name'); ?></h2>
		<ul class="boxmeup">
			<li><?php if (function_exists("validator_campaign_short")) validator_campaign_short(); ?></li>
			<li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li>
			<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress</a></li>
			<li><a href="http://rudd-o.com/projects/revvedup/" title="I am using the RevvedUp theme by Rudd-O">Enhanced by RevvedUp</a></li>
			<?php wp_meta(); ?>
			<li><?php include(dirname(__FILE__) . "/" . "cclicense.php"); ?></li>
			<li><script type="text/javascript" src="http://embed.technorati.com/embed/nt5dbfsin.js"></script></li>
		</ul>

		<?php } ?>

		<div id="firefox-referral">
			<?php include(TEMPLATEPATH . "/adreferral.php"); ?>
		</div>

		</td>

		<td id="sidebar-col2" class="sidebar-column">
		<div class="sidebar-column-spacer"></div>
		</td>

		<td id="sidebar-col3" class="sidebar-column">

		<?php if (function_exists("jal_get_shoutbox")) { ?>
			<h2 id="heading-chat">Live chat</h2>
			<?php if (function_exists("get_useronline")) { ?>
				<p id="useronline"><a href="<?php bloginfo('wpurl'); ?>/wp-useronline.php"><?php get_useronline(); ?></a></p>
			<?php } ?>
			<?php jal_get_shoutbox(); ?>
		<?php } ?>

		<h2 id="heading-subscribe">Join us and subscribe</h2>

<?php get_currentuserinfo(); global $user_ID; if ( $user_ID ) { ?>

<p>You're currently logged in.  If you want to, you can <?php wp_loginout($before="",$after="") ?>. </p>

<?php } else { ?>

		<p><?php wp_register($before="",$after=""); ?> at <?php bloginfo('name'); ?> today, and get your permanent nickname for comments and live chat!  Remember to <?php wp_loginout($before="",$after=""); ?> after you've subscribed.</p>

<?php } ?>
		<?php if (function_exists("the_subscribe_links")) { ?>
		<p>Get the scoop on new articles, and be the first to know when <?php bloginfo('name'); ?> is updated:</p>
		<?php the_subscribe_links(); ?>
		<?php } ?>

		<?php if (is_really_single()) { // FIXME use bsuite for this ?>
		<?php if (function_exists("related_posts")) { ?>
		<h2 id="heading-related-articles">Related articles</h2>
		<ul class="boxmeup">
			<?php related_posts(); ?>
		</ul>
		<?php } ?>
		<?php } ?>

		<?php if (!is_really_single()) { ?>
		<?php if (function_exists("get_recent_comments")) { ?>
		<h2 id="heading-recent-conversations">Recent conversations</h2>
		<ul class="boxmeup">
			<?php get_recent_comments(); ?>
		</ul>
		<?php } ?>
		<?php } ?>

		<?php if (!is_really_single() && 0) { ?>
		<?php if (function_exists("bstat_discussionbypost")) { ?>
		<h2 id="heading-recent-conversations">Recent conversations</h2>
		<ul class="boxmeup">
			<?php bstat_discussionbycomment(5, "<li>", "</li>\n"); ?>
		</ul>
		<?php } ?>
		<?php } ?>

		<?php if (function_exists("bstat_recentpop")) { ?>
		<h2 id="heading-popular-articles">Popular articles</h2>
		<ul class="boxmeup">
			<?php bstat_recentpop($maxresults=5,$days=30,$before='<li>',$after='</li>'); ?>
		</ul>
		<?php } ?>

		<?php /* If this is the frontpage */ /*if ( is_home() )*/  if(1) /* overridden! */ { ?>
			<h2 id="heading-favorite-sites">Rudd-O's favorite sites</h2>
			<ul class="boxmeup">
				<?php get_links(1,'<li>','</li>',' <br/> '); ?>
			</ul>
		<?php } ?>

		<?php /* If theme switcher enabled */ if ( function_exists("wp_theme_switcher") ) /* disabled because the themes do not support the theme switcher! */{ ?>
			<h2>Themes</h2>
			<?php wp_theme_switcher(); ?>
		<?php } ?>

		</td>
			
		</tr>
	    </table>
	</div>

