function MainScreenAndShopFunc(message)
	if message == "Main screen or shop money pressed" then
		local money = PermanentStorage.GetLocalInt("Money")
		SendMessage("Money edit dialog", "instantiate MoneyEditTemplate")
		SendMessage("Money edit mover", "report arrival to null")
		SendMessage("Money edit mover", "set arrival message null")
		SendMessage("Money edit mover", "move to in")
		SendMessage("Money edit", "set value "..money)
	elseif message == "Change money dialog ok button pressed" then
		local newMoneyStr = SendMessageReply("Money edit", "get value")
		if string.find(newMoneyStr, "^%d%d?%d?%d?%d?%d?%d?$") ~= nil then
			-- не более 7 цифр, потому что далее Lua округляет
			-- float? Он точно представляет целые до 16777216.
			PermanentStorage.SetLocalInt("Money", newMoneyStr * 1)
			SendMessage("Money edit", "disable cursor")
			SendMessage("Money edit mover", "report arrival to null")
			SendMessage("Money edit mover", "set arrival message null")
			SendMessage("Money edit mover", "move to out")
			SendMessage("Money edit dialog", "hide")
		end
	elseif message == "Change money dialog cancel button pressed" then
		SendMessage("Money edit", "disable cursor")
		SendMessage("Money edit mover", "report arrival to null")
		SendMessage("Money edit mover", "set arrival message null")
		SendMessage("Money edit mover", "move to out")
		SendMessage("Money edit dialog", "hide")
	else
		assert(false, "Unknown message "..message)
	end
end