local iIndex = Var("GameCommand"):GetIndex();
local sName = Var("GameCommand"):GetName();

-- common stuff for everyone to love!!
local genericGainFocusCmd = cmd(finishtweening;visible,true);
local genericLoseFocusCmd = cmd(visible,false);

local t = Def.ActorFrame{
	Name="Item"..iIndex;
	
	GainFocusCommand=genericGainFocusCmd;
	LoseFocusCommand=genericLoseFocusCmd;
	
	LoadFont("_frutiger lt std 55 roman 24px")..{
		Name="ToastyName"..iIndex;
		Text=THEME:GetString(Var 'LoadingScreen',sName);
		InitCommand=cmd(shadowlength,1;diffuse,color("#FFFFFF");horizalign,left;zoom,0.8;wrapwidthpixels,280);
		OnCommand=cmd(x,30;y,-12);
	};
	LoadFont("_frutiger lt std 55 roman 24px")..{
		Name="ToastyOrigin"..iIndex;
		Text=THEME:GetString(Var 'LoadingScreen',sName.."Origin");
		InitCommand=cmd(shadowlength,1;diffuse,color("#FFFFFF");horizalign,left;vertalign,top;zoom,0.8;wrapwidthpixels,280);
		OnCommand=cmd(x,30;y,28);
	};
	LoadFont("_frutiger lt std 55 roman 24px")..{
		Name="ToastyDesc"..iIndex;
		Text=THEME:GetString(Var 'LoadingScreen',sName.."Desc");
		InitCommand=cmd(shadowlength,1;diffuse,color("#FFFFFF");horizalign,left;vertalign,top;zoom,0.8;wrapwidthpixels,280);
		OnCommand=cmd(x,30;y,86);
	};
	
	LoadActor("_"..sName)..{
		InitCommand=cmd(x,-SCREEN_WIDTH/4);
		BeginCommand=function(self)
			-- zoom out snorlax
			if sName == "Snorlax" then self:zoom(0.6);
			else self:zoom(1);
			end;
		end;
	};
	
	LoadActor( THEME:GetPathS("_toasty",sName) )..{
		GainFocusCommand=function(self)
			self:play();
			-- lock for specified amount of time here
			-- this prevents users from overloading sounds
			local times = {
				Forden = 0.6,
				Nima = 1.74,
				Snorlax = 4.173,
				BangBang = 0.690,
				Charmy = 1.175
			};
			SCREENMAN:GetTopScreen():lockinput(times[sName]);
		end;
		LoseFocusCommand=cmd(pause);
		
		-- while we're here let's set some dumb shit here
		OffFocusedCommand=function(self)
			SetToasty(sName);
		end;
	};
};

return t;