	jQuery(document).ready(function(){
    jQuery('body #content h3').each( function(i){
            jQuery(this).attr({ id: 'i' + ++i }).wrapInner('<a class="selH" href="#i'+i+'"></a>');
     })
        
    var selH = jQuery('.selH');
        if ( selH.length> 1) {
          jQuery('<div id="page-contents"></div>')
            .prepend('<h4 id="pc">Page Contents</h4>')
            .append('<div></div>')
            .prependTo('div#sidebar');

      selH.each(function(index) {
        var $this = jQuery(this);
        var thisId = $this.id;
        $this
          .clone().attr('id', 'pc-' + index)
          .appendTo('#page-contents div');           
      });   
     }
     
     jQuery('body div#content h3').before('<a class="returnanchor" href="#top">Top</a> ');
      });
