
function OnCreateContent()
--	introScreen = screen;
	assert(introScreen);

	CreateButtons();

	introMovieDuration = 34.0 + (20.0/60.0);
	do
	    local movie = CreateMovieEntity();
	    movie:AttachTo(introScreen);
		movie:SetXY(SCREEN_WIDTH/2.0, SCREEN_HEIGHT/2.0);
		movie:SetScale(SCREEN_WIDTH/640.0);
		movie:SetRepeat(false);
		movie:PlayMovie('data/Video/Intro2.ogg', 
						'data/Music/introAnimation.ogg');

		local tmargin = CreateSprite(); 
		tmargin:SetName('TopMargin');
		tmargin:AttachTo(introScreen);
		tmargin:SetSprite('MarginTexture');
		tmargin:SetXY(SCREEN_WIDTH/2.0, -4.0);
		tmargin:SetHotSpot(SCREEN_WIDTH/2.0, 0.0);
		tmargin:SetZ(100.0);
		tmargin:SetVisible(true);

		local bmargin = CreateSprite(); 
		bmargin:SetName('BottomMargin');
		bmargin:AttachTo(introScreen);
		bmargin:SetSprite('MarginTexture');
		bmargin:SetXY(SCREEN_WIDTH/2.0, SCREEN_HEIGHT + 4.0);
		bmargin:SetHotSpot(SCREEN_WIDTH/2.0, 0.0);
		bmargin:SetScaleY(-1.0);
		bmargin:SetZ(100.0);
		bmargin:SetVisible(true);
	end
end

function OnFreeContent()
	introScreen = nil;
end

function OnUpdate(dt)
	--// set movie duration at first update
	if (introMovieDuration ~= nil) then
	    introScreen:SetDuration(introMovieDuration);
		introMovieDuration = nil;
	end
end

-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function LoadIntroData()
end
function FreeIntroData()
end
------------------------------------------------------------------------------
--// auxiliary functions

function CreateButtons()
	local skipButton = CreateButton('IntroSkipButtonUp','IntroSkipButtonOver','IntroSkipButtonDown', 'MSG_SKIP_INTRO', introScreen);
	skipButton:AttachTo(introScreen);
	skipButton:SetScale(0.7);
	skipButton:SetXY(860.0, 40.0);
	skipButton:SetZ(1000.0);
	skipButton:SetVisible(true);

--// ToDo: bind to Lua and call:	Engine->AudioManager->PlayMusic("introSound");
end
