<?php
/**
 * The Sidebar containing the primary and secondary widget areas.
 *
 * @package WordPress
 * @subpackage ThinkPlace
 * @since ThinkPlace 1.0
 */?>
 
 		<div id="sidebar">
            

                
<?php
  // Check for ancestors
  $ancestors = $post->ancestors;
  if($ancestors) {
    // Decide whether context is parent or current post
    $context = (count($ancestors) > 1) ? $ancestors[0] : $post->ID;
    $children = wp_list_pages("title_li=&child_of=".$context."&echo=0&depth=1");
    if ($children) {
?>
    <div id="sub-nav">
  	  <ul>
  	  <?php echo $children; ?>
  	  </ul>
    </div>
<?php
    }
  }
?>




			<?php
        $related = wp_get_related_links();
        // Ridiculous hack
        if ($related && $related != "<ul class='related_links'><li>No entries found</li></ul>") { ?>
          <div id="related-links">
              <h2>You might also like</h2>
              <ul>
              <?php echo $related; ?>
              </ul>
          </div><!--related-links-->
        <?php } ?>
            
        <div id="tag-cloud">
            <h2>Tag cloud</h2>
            <?php wp_tag_cloud('smallest=8&largest=14&number=50'); ?>
        </div><!--tag-cloud-->
        
        <!-- AddThis Button BEGIN -->
        <div class="addthis_toolbox addthis_default_style ">
        <a href="http://www.addthis.com/bookmark.php?v=250&amp;pubid=xa-4d69f9734493aefc" class="addthis_button_compact">Share</a>
        <span class="addthis_separator">|</span>
        <a class="addthis_button_preferred_1"></a>
        <a class="addthis_button_preferred_2"></a>
        <a class="addthis_button_preferred_3"></a>
        <a class="addthis_button_preferred_4"></a>
        </div>
        <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4d69f9734493aefc"></script>
        <!-- AddThis Button END -->
    </div><!--sidebar-->
	</div> <!--content-container-->