/**
     * @return void
     * @desc Fires before closing the body element of the page
     */
    protected function OnBodyClosing()
    {
        # Close open divs
        if ($this->b_col1_open) {
            echo '</div></div>';
        }
        if ($this->b_col2_open) {
            echo '</div>';
        }
        if ($this->i_constraint_type != StoolballPage::ConstrainNone()) {
            echo '</div>';
        }
        # Close <div id="constraint">
        ?>
	</div>
	<div id="sidebar">
	<?php 
        if (AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::VIEW_ADMINISTRATION_PAGE)) {
            $o_menu_link = new XhtmlElement('a', 'Menu');
            $o_menu_link->AddAttribute('href', '/yesnosorry/');
            echo new XhtmlElement('p', $o_menu_link, "screen");
        }
        # Add WordPress edit page link if relevant
        if (SiteContext::IsWordPress() and AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::VIEW_WORDPRESS_LOGIN)) {
            global $post;
            $b_wordpress_edit_allowed = true;
            echo '<ul>';
            if ($post->post_type == 'page') {
                if (!current_user_can('edit_page', $post->ID)) {
                    $b_wordpress_edit_allowed = false;
                }
            } else {
                if (!current_user_can('edit_post', $post->ID)) {
                    $b_wordpress_edit_allowed = false;
                }
            }
            if ($b_wordpress_edit_allowed) {
                echo '<li><a href="' . apply_filters('edit_post_link', get_edit_post_link($post->ID), $post->ID) . '">Edit page</a></li>';
            }
            if (function_exists('wp_register')) {
                wp_register();
                echo '<li>';
                wp_loginout();
                echo '</li>';
                wp_meta();
            }
            echo '</ul>';
        }
        echo '<h2 id="your" class="large">Your stoolball.org.uk</h2>';
        $authentication = new AuthenticationControl($this->GetSettings(), AuthenticationManager::GetUser());
        $authentication->SetXhtmlId('authControl');
        echo $authentication;
        # Add admin options
        $this->Render();
        # Add next matches
        $num_matches = count($this->a_next_matches);
        if ($num_matches) {
            $next_alt = $num_matches > 1 ? "Next {$num_matches} matches" : 'Next match';
            echo '<h2 id="next' . $num_matches . '" class="large"><span></span>' . $next_alt . '</h2>';
            $o_match_list = new MatchListControl($this->a_next_matches);
            $o_match_list->UseMicroformats(false);
            # Because parse should look at other match lists on page
            $o_match_list->AddCssClass("large");
            echo $o_match_list;
            echo '<p class="large"><a href="/matches">All matches and tournaments</a></p>';
        }
        $this->Render();
        ?>
	</div>
	<div id="boardBottom">
		<div>
			<div></div>
		</div>
	</div>
</div></div></div>
<div id="post"></div>
	<?php 
        if (!SiteContext::IsDevelopment() and !AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::EXCLUDE_FROM_ANALYTICS)) {
            ?>
<script>
var _gaq=[['_setAccount','UA-1597472-1'],['_trackPageview'],['_setDomainName','.stoolball.org.uk'],['_trackPageLoadTime']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
		<?php 
        }
        if ($this->GetHasGoogleMap()) {
            // Load Google AJAX Search API for geocoding (Google Maps API v3 Geocoding is still rubbish 29 Oct 2009)
            $s_key = SiteContext::IsDevelopment() ? 'ABQIAAAA1HxejNRwsLuCM4npXmWXVRRQNEa9vqBL8sCMeUxGvuXwQDty9RRFMSpVT9x-PVLTvFTpGlzom0U9kQ' : 'ABQIAAAA1HxejNRwsLuCM4npXmWXVRSqn96GdhD_ATNWxDNgWa3A5EXWHxQrao6MHCS6Es_c2v0t0KQ7iP-FTg';
            echo '<script src="https://www.google.com/uds/api?file=uds.js&amp;v=1.0&amp;key=' . $s_key . '"></script>';
            // Load Google Maps API v3
            echo '<script src="https://maps.google.co.uk/maps/api/js?sensor=false"></script>';
        }
    }