-- Main game loop
function Main()

	-- This is technically not needed at the start of main, but it's included
	-- here to remind Playground users to call it before they call Load() again,
	-- so that their progress bar will work correctly.
	LoaderReset();

	-- Queue up some assets to load
	Load("scripts/preload.loader.lua","coreassets");
	Load("scripts/preload.loader.lua","mainmenu");

	--[[DisplaySplash(
		"splash/playfirst_animated_logo.swf",
		"splash/playfirst_logo",4000
		);]]

	--DisplaySplash("", "splash/distributor_logo",4000);

	-- Bring up the loading screen the first time. The script
	-- will pause here until the loader is done.
	DisplaySplash("","splash/paramount_logo",3000);
	DisplaySplash("","splash/merscom_logo",2000);
	DisplaySplash("","splash/anino_logo",2000);
	DoModal("scripts/firstload.lua");

	-- Push the game selection screen
	while true do
		DoMainWindow("scripts/mainmenu.lua");
		-- DoMainWindow will exit only if there are NO windows currently on the stack, so
		-- a PopModal()/PushModal() combination will not cause this to loop.
	end
end

-- Return a function to be executed in a thread
return Main