{

	myPopup

	Init[ (s)
	{
		MenuBackground(92);

		AddStaticItem(26);
		AddStaticItem(26);
		AddStaticItem(26);
		AddStaticItem(26);

		if (GameActive())
		{
			AddStaticItem(26);
			AddMenuItem(101,"MenuReturnToGame");

			// for now, don't allow loading more than one level
			AddStaticItem(26);

			AddStaticItem(26);
			AddStaticItem(102);
		}
		else
		{
			AddStaticItem(26);
			AddMenuItem(102,"MenuNewGame");
		}

		if (IsMultiplayer())
		{
			AddStaticItem(443);
		}
		else
		{
			AddMenuItem(443,"MenuLoadSave");
		}

		//AddStaticItem(26);
		if (not GameActive())
		{
			AddStaticItem(26);
			AddMenuItem(103,"MenuMultiplayer");
			//if (not ArenaActive())
			//{
				//AddStaticItem(26);
			//	AddMenuItem(444,"MenuArena");
			//}
			AddMenuItem(445, "MenuDownload");
		}

		if (not IsMultiplayer())
		{
			if (ExpansionPackAvailable())
			{
				AddMenuItem(446, "MenuExpansionPack");
			}
		}

		AddStaticItem(26);
		AddMenuItem(106,"MenuOptions");

		if (not GameActive())
		{
		AddMenuItem(447, "MenuCredits");
		}

		if (GameActive())
		{
			myPopup=CreatePopupMenu(18,75,150,60);
			myPopup.AddItem(492);
			myPopup.AddItem(49,"ActuallyQuitGame");
			myPopup.AddItem(50,"CancelQuitGame");
			myPopup.SetSelectable(0,false);
			myPopup.SetVisible(false);
			myPopup.SetSelectedItem(2);
			myPopup.SetBackground();

			AddMenuItem(448,"MenuQuit");
		}
		else
		{
			myPopup=CreatePopupMenu(18,75,150,60);
			myPopup.AddItem(492);
			myPopup.AddItem(49,"ActuallyQuitGame");
			myPopup.AddItem(50,"CancelQuitGame");
			myPopup.SetSelectable(0,false);
			myPopup.SetVisible(false);
			myPopup.SetSelectedItem(2);
			myPopup.SetBackground();

			AddMenuItem(449,"MenuQuit");
		}

		if (GameActive() = 0)
		{
			funwithsimkin = 0;
		}
		else
		{
			AddStaticItem(26);
		}

		if (not IsMultiplayer())
		{
			if( CheatsActivated() )
			{
				AddMenuItem(108,"MenuLoadLevel");
			}
		}

		funtext=AddFloatingTextJustify(GetVersionNumber(), 175, 1, true,32767);
		funtext.SetFontNum(1);

		funtext=AddFloatingTextJustify(530, 0, 195, false,32767);
		funtext.SetFontNum(1);

	} ]

	MenuExpansionPack[(s)
	{
		OpenMenu("ExpansionPack");
	}]

	MenuLoadSave[(s)
	{
		OpenMenu("LoadSave");
	}]

	MenuLoadLevel[(s)
	{
		OpenMenu("LoadLevel");
	}]

	MenuNewGame[ (s)
	{
		// Tell the engine to start a new game
		//NewGame();
		// Actually, first go to the difficulty level menu
		OpenMenu("Difficulty");
	} ]

	MenuLoadGame[ (s)
	{
		// Tell the engine to load a new game (probably opens a new menu)
		//MenuBackground(20);
		//Quit();
		//LoadGame();
		OpenMenu("LoadGameMenu");
	} ]

	MenuSaveGame[ (s)
	{
		// Tell the engine to save a new game (probably opens a new menu)
		//SaveGame("SaveGameCallBack");
		OpenMenu("SaveGameMenu");
	} ]


	MenuMultiplayer[ (s)
	{
		OpenMenu("Multiplayer");
	} ]

	MenuArena[ (s)
	{
		ArenaConnect();
		//OpenMenu("Arena");
	} ]

	MenuDownload[ (s)
	{
		//MenuBackground(20);
		OpenMenu("DownloadsMenu");
	} ]

	MenuOptions[ (s)
	{
		//Options();
		OpenMenu("Options");
	} ]

	MenuCredits[ (s)
	{
		ShowCredits();
	} ]

	MenuReturnToGame[ (s)
	{
		ReturnToGame();
	} ]

	MenuQuit[ (s)
	{
		myPopup.SetVisible(true);
		myPopup.SetSelectedItem(2);
		//Quit();
	} ]

	ActuallyQuitGame[ (s)
	{
		myPopup.SetVisible(false);
		Quit();
	} ]

	CancelQuitGame[ (s)
	{
		//myPopup.SetVisible(false);
		ClearMenu();
		Init();
	} ]

	OnRightSoftkey[ (s)
	{
		if (GameActive())
		{
			MenuReturnToGame();
		}
	} ]

	MainMenuBack[ (s)
	{
		ClearMenu();
		Init();
	}]
}