-- events 

timer = 0


function OnLoad ()
	--SetProperty ("/:enable_event_on_key_down", 1);
	SetProperty ("/:enter_trans_duration", 0.2);
	SetProperty ("/:leave_trans_duration", 0.2);
end;

function OnKeyDown (key)
	Print("Any Key Down\n");
	-- any key speeds up leaving this screen
	if (timer > 1.0) then
		PopScreen ();
	end;

end;

function OnEnter ()
	Reset ();
	
		if (Azkend_AutoplayerActive ()) then
			PopScreen ();
		end;
end;

function OnLeave ()

end;

function Reset ()
   timer = 0

end;

function OnClick (name)

	Print ("OnClick " .. name .. "\n");
		
	if (name == "Ok") then			
		PopScreen ();
		
		return;
	end;
	
		
	if (name == "Menu") then	
		PushScreen ("GamePopMenu");
		return;
	end;
	
end;


function OnUpdate (tdelta)

	timer = timer + tdelta;    
	akey = GetActiveScreenAnimKey ();	
	alpha = GetActiveScreenTransPhase();
	SetProperty ("panel:alpha", math.min (alpha, 2*timer));
	local offset = 15 * (1 + math.cos (timer*5));
	SetProperty ("arrow:position_offset.x", offset);
	SetProperty ("arrow:position_offset.y", -offset);

	
	if (timer > 3.5) then
		--PopScreen ();
	end;
    
end;

function OnDraw ()
	Azkend_DrawSmallClock ();

end;
