// Initialise global Hc context
var Hc = Hc || {};

Hc.SubMenu = {

	click : function() {

		// if already selected then nothing to do here....
		if( $(this).parent().hasClass('selected') ) return false;
		
		// move the section to the top of the tab content.
		var section = $(this).attr('href');
//		$('.tabContent').prepend($(section));
				
		// move the menu to inside the top section
//		$(section).prepend($('#subMenuTop'));

		// finally, select the correct tab from the menu
		$('#subMenuTop').find('li').each( function(){
			$(this).removeClass('selected');
		});
		$(this).parent().addClass('selected');

		// hide all the vertical sections by default.
		$('.section').css('display','none');
		// but show the section we've now moved to the top.
		$(section).css('display','block');
		
		if( $(section).attr('id') == "mapSearch") {
			loadMap();
		}
		
		return false;
	},	

	init : function() {
//		$('#subMenuTop').find('a').click( Hc.SubMenu.click );
		
//		$('.section').css('display','none');
//		setTimeout(function(){$("#overview").css("display","block");}, 100);
//		setTimeout(function(){$("#about").css("display","block");}, 100);
	}
};
