<div id="sidebar">

	<?php 
		if(is_home() && is_active_sidebar(2)) : dynamic_sidebar(2);
		elseif(is_archive() && is_active_sidebar(3)) : dynamic_sidebar(3);
		elseif(is_single() && is_active_sidebar(4)) : dynamic_sidebar(4);
		elseif(is_page() && is_active_sidebar(5)) : dynamic_sidebar(5);
	else : ?>
	
		<?php if (!dynamic_sidebar(1)) : ?>
		
    	<div id="sb-recent" class="sb-box">
    	
    		<h3 class="sb-title"><?php _e('Recent Articles',TS_DOMAIN); ?></h3>
    		
    		<ul>
    		<?php $recent = new WP_Query("showposts=5"); while($recent->have_posts()) : $recent->the_post();?>
    			<li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
    		<?php endwhile; ?>
    		</ul>
    	
    	</div><!-- end sb-box -->
    	
    	<div id="sb-search" class="sb-box clearfix">
    	
    		<h3 class="sb-title"><?php _e('Search this Site',TS_DOMAIN); ?></h3>
		
    		<?php include(TEMPLATEPATH .'/searchform.php'); ?>
    	
    	</div><!-- end sb-box -->
    	
    	<div id="sb-bookmarks" class="sb-box">
    	
    		<?php wp_list_bookmarks('title_li=&category_before=<div class="box-right">&category_after=</div>&title_before=<h3 class="sb-title">&title_after=</h3>'); ?>
    	
    	</div>
    	
    	<?php endif; // endif dynamic sidebar ?>
    	
    <?php endif; // endif active Sidebar - Home ?>

</div><!-- end sidebar -->