//ugly-but-effective hide/show for topics/maps

function menuInit(t, m, id){
	t.observe('click', function(e){
		Event.stop(e);
		$('pagetopics').toggle();
		t.toggleClassName('tool_active');
		if(m.hasClassName('tool_active')){
			$('pagemap').hide();
			if(!$('mapcontainer').empty()){
				$('mapcontainer').hide();
			}
			m.removeClassName('tool_active');
		}
	}, false);
	m.observe('click', function(f){
		Event.stop(f);
		$('pagemap').toggle();
		if($('mapcontainer').empty()){
			initializeMap(id);
		}
		else {
			$('mapcontainer').toggle();
		}
		m.toggleClassName('tool_active');
		if(t.hasClassName('tool_active')){
			$('pagetopics').hide();
			t.removeClassName('tool_active');
		}
	}, false);
}

window.onload = function(){
	menuInit($('show_topics'), $('show_map'), currentPage);
}