function mainm.init()
	connectm.init()
	hostm.init()
	gui_load_gss("menu-common")
	gui_load_gss("main-menu")
	local menu = gui_load_xml("main-menu")
	local win = menu:child("main-win")
	local connectBtn = win:child("main-connect")
	local hostBtn = win:child("main-host")
	local quitBtn = win:child("main-quit")
	local continueBtn = menu:child("main-continue")

	function mainm.isShown()
		return connectm.isShown() or hostm.isShown() or menu:is_visible()
	end

	function mainm.show()
		if not menu:is_visible() then
			menu:set_visibility(true)
			menu:focus()
			win:focus()
			connectBtn:focus()
		end
	end

	function mainm.hide()
		menu:set_visibility(false)
	end

	function continueBtn:onAction()
		if map_is_loaded() then
			mainm.hide()
		end
	end

	function connectBtn:onAction()
		mainm.hide()
		connectm.show()
	end

	function hostBtn:onAction()
		mainm.hide()
		hostm.show()
	end

	function quitBtn:onAction()
		quit()
	end

	function menu:onKeyDown(k)
		if k == Keys.ESC and map_is_loaded() then
			mainm.hide()
			return true
		end
	end

	if map_is_loaded() then
		mainm.hide()
	else
		mainm.show()
	end

end