-- events for main menu


function OnLoad ()
	SetProperty ("/:enter_trans_duration", 0.4);
	SetProperty ("/:leave_trans_duration", 0.4);
	CacheSound ("ui/sfx/panel_move.ogg");
	LoadUI ("ui/instructions-page3.lua");
	LoadUI ("ui/instructions-thunder-meter.lua");
	LoadUI ("ui/instructions.lua");

end;






function OnEnter ()
	ownTransfer();
	PlaySound ("ui/sfx/panel_move.ogg");
	LoadUI ("ui/instructions.lua");
	ownTransfer();
	
	--SetProperty ("Thunder:visible", 0);


end;

function OnLeave ()
    
end;


function OnClick (name)

--	Print ("OnClick " .. name .. "\n");
	
	if (name == "Ok") then
	    	PlaySound ("ui/sfx/panel_move.ogg");
				PopScreen ();
		return;
	end;	
	
	if (name == "Basic") then
	    	LoadUI ("ui/instructions.lua");
	    	ownTransfer();
		return;
	end;
	
	if (name == "Advanced") then
	    	LoadUI ("ui/instructions-thunder-meter.lua");
	    	ownTransfer();
		return;
	end;
	
	if (name == "Thunder") then
	    	LoadUI ("ui/instructions-page3.lua");
	    	ownTransfer();
		return;
	end;

end;




function OnUpdate (tdelta)


end;

function OnDraw ()
	ownTransfer();	
end;

function ownTransfer ()
	akey = GetActiveScreenAnimKey ();

	trans = math.sin (0.5*3.1415926535 * GetActiveScreenTransPhase ());
	SetProperty ("panel:position_offset.y", (1-trans) * 200);
	SetProperty ("panel:alpha", trans);
	SetProperty ("fader:alpha", trans + trans * 0.05 * math.sin (2*3.141592*akey));
end;