------------------------------------------------------------------
--								--
--			KoRi's MyMenu				--
--								--
------------------------------------------------------------------

function MyPlayers(mname)
	local Entity 
	
	if GameRules then
		Entity = System:GetEntity(GameRules.idScoreboard).cnt;
	elseif ClientStuff then
		Entity = System:GetEntity(ClientStuff.idScoreboard).cnt;
	end

	local iY,X;
	local iLines=Entity:GetLineCount()-1;
	
	for iY=0,iLines do
		local idThisClient = Entity:GetEntryXY(ScoreboardTableColumns.ClientID,iY)-1;
		
		if idThisClient~=-1 then
			if Entity:GetEntryXY(ScoreboardTableColumns.sName,iY) == mname then
				return idThisClient;
			end
		end
	end
	return -1;
end

UI.PageMyMenu=
{	
	Playerk = {},
	fvarsRefreshingTime = 0,
	PlayerTypeIcon = 
	{
				{ System:LoadImage("textures/gui/playericons"), 18, 18, "1 	1		22 	22", }, -- 1 - red
				{ System:LoadImage("textures/gui/playericons"), 18, 18, "25 	1		22	22", }, -- 2 - red
				{ System:LoadImage("textures/gui/playericons"), 18, 18, "49	1		22	22", }, -- 3 - red
				{ System:LoadImage("textures/gui/playericons"), 18, 18, "73 	1		22 	22", }, -- 4 - white /spectator
				{ System:LoadImage("textures/gui/playericons"), 18, 18, "1 	25		22	22", }, -- 5 - blue
				{ System:LoadImage("textures/gui/playericons"), 18, 18, "25	25		22	22", }, -- 6 - blue
				{ System:LoadImage("textures/gui/playericons"), 18, 18, "49	25		22	22", }, -- 7 - blue
	 }, 
	 
	GUI=
	{	
		dedcon = "",		 	 
		TeambalanceBtn=
		{
			skin = UI.skins.CheckBox,
			color = "255 255 255 255",
			style = 0,
			left = 50, top = 200,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/TeamBalance_e.dds"),
			downtexture = System:LoadImage("textures/gui/TeamBalancec_e.dds"),
			overtexture = System:LoadImage("textures/gui/TeamBalance_as.dds"),
			texrect = "0 0 125 28",	
			tabstop = 1,
				
			OnChanged = function(self)
				UI.PageMyMenu.GUI.HideListWindow();
				UI.PageMyMenu.GUI.DoLostFocusW();
				if(self:GetChecked()) then
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_team_balance 1");
				else
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_team_balance 0");
				end
				UI.PageMyMenu:RefreshVars();
			end,
		},
		
		TeamSwitchBtn=
		{
			skin = UI.skins.CheckBox,
			left = 50, top = 228,
			width = 120, height = 23,
			bordersides = "",
			color = "255 255 255 255",
			texture = System:LoadImage("textures/gui/TeamSwitch_e.dds"),
			downtexture = System:LoadImage("textures/gui/TeamSwitchc_e.dds"),
			overtexture = System:LoadImage("textures/gui/TeamSwitch_a.dds"),
			texrect = "0 0 125 28",
			tabstop = 2,

			OnChanged = function(self)
				UI.PageMyMenu.GUI.DoLostFocusW();
				UI.PageMyMenu.GUI.HideListWindow();
				if(self:GetChecked()) then
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_allow_teamswitch 1");
				else
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_allow_teamswitch 0");
				end
				UI.PageMyMenu:RefreshVars();
			end,
		},
		
		LockTeamBtn=
		{
			skin = UI.skins.TopMenuButton,
			left = 50, top = 256,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/LockTeam_e.dds"),
			downtexture = System:LoadImage("textures/gui/LockTeam_c.dds"),
			overtexture = System:LoadImage("textures/gui/LockTeam_a.dds"),
			texrect = "0 0 125 28",
			tabstop = 3,
			
			OnGotFocus = function(self)
				UI.PageMyMenu.GUI.DoLostFocusW();
				UI.PageMyMenu.GUI.HideListWindow();
				UI:ShowWidget("LockRedBtn", "MyMenu");
				UI:ShowWidget("LockBlueBtn", "MyMenu");
			end,
			
			OnLostFocus = function(self)
				UI:HideWidget("LockRedBtn", "MyMenu");
				UI:HideWidget("LockBlueBtn", "MyMenu");

			end,
		},
		
		LockRedBtn=
		{
			skin = UI.skins.CheckBox,
			left = 175, top = 256,
			width = 120, height = 23,
			bordersides = "",
			color = "255 255 255 255",
			texture = System:LoadImage("textures/gui/Redo_e.dds"),
			downtexture = System:LoadImage("textures/gui/Redc_e.dds"),
			overtexture = System:LoadImage("textures/gui/Redo_a.dds"),
			texrect = "0 0 125 28",

			OnChanged = function(self)
				if(self:GetChecked()) then
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_forcebluejoin 1");
				else
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_forcebluejoin 0");
				end
				UI.PageMyMenu:RefreshVars();			
			end,
		},
		
		LockBlueBtn=
		{
			skin = UI.skins.CheckBox,
			left = 175, top = 277,
			width = 120, height = 23,
			bordersides = "",
			color = "255 255 255 255",
			texture = System:LoadImage("textures/gui/Blueo_e.dds"),
			downtexture = System:LoadImage("textures/gui/Bluec_e.dds"),
			overtexture = System:LoadImage("textures/gui/Blueo_a.dds"),
			texrect = "0 0 125 28",

			OnChanged = function(self)
				if(self:GetChecked()) then
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_forceredjoin 1");
				else
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_forceredjoin 0");
				end
				UI.PageMyMenu:RefreshVars();			
			end,
		},
		
		DamageBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 50, top = 284,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/Damage_e.dds"),
			downtexture = System:LoadImage("textures/gui/Damage_c.dds"),
			overtexture = System:LoadImage("textures/gui/Damage_a.dds"),
			texrect = "0 0 125 28",
			tabstop = 4,
			
			OnGotFocus = function(Self)
				UI.PageMyMenu.GUI.HideListWindow();
				UI.PageMyMenu.GUI.DoLostFocusW();
				UI:ShowWidget("Dam1Btn", "MyMenu");
				UI:ShowWidget("Dam2Btn", "MyMenu");
				UI:ShowWidget("Dam3Btn", "MyMenu");
				UI:ShowWidget("Dam4Btn", "MyMenu");
				UI:ShowWidget("Dam5Btn", "MyMenu");
			end,
			
			OnLostFocus = function(Self)
				UI:HideWidget("Dam1Btn", "MyMenu");
				UI:HideWidget("Dam2Btn", "MyMenu");
				UI:HideWidget("Dam3Btn", "MyMenu");
				UI:HideWidget("Dam4Btn", "MyMenu");
				UI:HideWidget("Dam5Btn", "MyMenu");
			end,
		},
		Dam1Btn =
		{
			skin = UI.skins.TopMenuButton,
			left = 175, top = 284,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/After_e.dds"),
			downtexture = System:LoadImage("textures/gui/After_c.dds"),
			overtexture = System:LoadImage("textures/gui/After_a.dds"),
			texrect = "0 0 125 28",

			OnCommand = function(Sender)
				System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_DisplayStat 1");
				Game:SendMessage("Switch");
			end,
		},
		Dam2Btn =
		{
			skin = UI.skins.TopMenuButton,
			left = 175, top = 305,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/Before_e.dds"),
			downtexture = System:LoadImage("textures/gui/Before_c.dds"),
			overtexture = System:LoadImage("textures/gui/Before_a.dds"),
			texrect = "0 0 125 28",

			OnCommand = function(Sender)
				System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_DisplayStat 2");
				Game:SendMessage("Switch");
			end,
		},
		Dam3Btn =
		{
			skin = UI.skins.TopMenuButton,
			left = 175, top = 326,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/Afterm_e.dds"),
			downtexture = System:LoadImage("textures/gui/Afterm_c.dds"),
			overtexture = System:LoadImage("textures/gui/Afterm_a.dds"),
			texrect = "0 0 125 28",

			OnCommand = function(Sender)
				System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_DisplayStat 3");
				Game:SendMessage("Switch");
			end,
		},
		Dam4Btn =
		{
			skin = UI.skins.TopMenuButton,
			left = 175, top = 347,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/Beforem_e.dds"),
			downtexture = System:LoadImage("textures/gui/Beforem_c.dds"),
			overtexture = System:LoadImage("textures/gui/Beforem_a.dds"),
			texrect = "0 0 125 28",

			OnCommand = function(Sender)
				System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_DisplayStat 4");
				Game:SendMessage("Switch");
			end,
		},
		Dam5Btn =
		{
			skin = UI.skins.TopMenuButton,
			left = 175, top = 368,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/Off_e.dds"),
			downtexture = System:LoadImage("textures/gui/Off_c.dds"),
			overtexture = System:LoadImage("textures/gui/Off_a.dds"),
			texrect = "0 0 125 28",

			OnCommand = function(Sender)
				System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_DisplayStat 0");
				Game:SendMessage("Switch");
			end,
		},
		PlayersBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 50, top = 312,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/Players_e.dds"),
			downtexture = System:LoadImage("textures/gui/Players_c.dds"),
			overtexture = System:LoadImage("textures/gui/Players_a.dds"),
			texrect = "0 0 125 28",
			tabstop = 5,
			
			OnGotFocus = function(Sender)
				UI.PageMyMenu.GUI.DoLostFocusW();
				UI:ShowWidget("PlayerList", "MyMenu");
				UI:ShowWidget("JoinRedBtn", "MyMenu");
				UI:ShowWidget("JoinBlueBtn", "MyMenu");
				UI:ShowWidget("JoinSpectBtn", "MyMenu");
				UI:ShowWidget("KickBtn", "MyMenu");
				UI:ShowWidget("BanBtn", "MyMenu");
				UI:ShowWidget("PunishBtn", "MyMenu");
				UI:ShowWidget("ReasonText", "MyMenu");
				UI:ShowWidget("ReasonEB", "MyMenu");
				local pb = tonumber(getglobal("cl_punkbuster"));
				if(pb and pb==1) then
 					UI:ShowWidget("ScreenshotBtn", "MyMenu");
					UI:ShowWidget("ScreenshotFromRadarBtn", "MyMenu");
				end
				UI.PageMyMenu.GUI.PlayerList:OnChanged();
			end,
		},
		
		JoinRedBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 450, top = 200,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/joinred_e.dds"),
			downtexture = System:LoadImage("textures/gui/joinred_c.dds"),
			overtexture = System:LoadImage("textures/gui/joinred_a.dds"),
			
			texrect = "0 0 125 28",			
			
			OnCommand = function(Sender)
				local sel= UI.PageMyMenu.GUI.PlayerList:GetSelection(0);
				if (sel and UI.PageMyMenu.Playerk[sel-1]~="")then				
					local Plid = MyPlayers(UI.PageMyMenu.Playerk[sel-1]);
					if Plid~=-1 then
						System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."sv_chteam "..Plid.." red"); 
					end
				end
			end,		
		},
		
		JoinBlueBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 450, top = 228,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/joinblue_e.dds"),
			downtexture = System:LoadImage("textures/gui/joinblue_c.dds"),
			overtexture = System:LoadImage("textures/gui/joinblue_a.dds"),
			texrect = "0 0 125 28",			
			
			OnCommand = function(Sender)
				local sel= UI.PageMyMenu.GUI.PlayerList:GetSelection(0);
				if (sel and UI.PageMyMenu.Playerk[sel-1]~="")then				
					local Plid = MyPlayers(UI.PageMyMenu.Playerk[sel-1]);
					if Plid~=-1 then
						System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."sv_chteam "..Plid.." blue"); 
					end
				end
			end,		
		},		
		JoinSpectBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 450, top = 256,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/joinspect_e.dds"),
			downtexture = System:LoadImage("textures/gui/joinspect_c.dds"),
			overtexture = System:LoadImage("textures/gui/joinspect_a.dds"),
			texrect = "0 0 125 28",			
			
			OnCommand = function(Sender)
				local sel= UI.PageMyMenu.GUI.PlayerList:GetSelection(0);
				if (sel and UI.PageMyMenu.Playerk[sel-1]~="")then				
					local Plid = MyPlayers(UI.PageMyMenu.Playerk[sel-1]);
					if Plid~=-1 then
						System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."sv_chteam "..Plid.." spectators"); 
					end
				end
			end,		
		},
		
		KickBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 450, top = 290,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/Kick_e.dds"),
			downtexture = System:LoadImage("textures/gui/Kick_c.dds"),
			overtexture = System:LoadImage("textures/gui/Kick_a.dds"),
			texrect = "0 0 125 28",			

			OnCommand = function(Sender)
				local sel= UI.PageMyMenu.GUI.PlayerList:GetSelection(0);
				if (sel and UI.PageMyMenu.Playerk[sel-1]~="")then				
					local Plid = MyPlayers(UI.PageMyMenu.Playerk[sel-1]);
					if Plid~=-1 then
						System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."kickid "..Plid);
					end
				end
			end,	
		},
		
		BanBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 450, top = 318,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/ban_e.dds"),
			downtexture = System:LoadImage("textures/gui/ban_c.dds"),
			overtexture = System:LoadImage("textures/gui/ban_a.dds"),
			texrect = "0 0 125 28",			

			OnCommand = function(Sender)
				local sel= UI.PageMyMenu.GUI.PlayerList:GetSelection(0);
				if (sel and UI.PageMyMenu.Playerk[sel-1]~="")then				
					local Plid = MyPlayers(UI.PageMyMenu.Playerk[sel-1]);
					if Plid~=-1 then
						System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."banid "..Plid);
					end
				end
			end,	
		},

		ScreenshotBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 600, top = 200,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/sshot_e.dds"),
			downtexture = System:LoadImage("textures/gui/sshot_c.dds"),
			overtexture = System:LoadImage("textures/gui/sshot_a.dds"),
			texrect = "0 0 125 28",			

			OnCommand = function(Sender)
				local sel= UI.PageMyMenu.GUI.PlayerList:GetSelection(0);
				if (sel and UI.PageMyMenu.Playerk[sel-1]~="")then				
					local Plid = MyPlayers(UI.PageMyMenu.Playerk[sel-1]);
					if Plid~=-1 then
						Client:SendCommand("GSS "..Plid);
					end
				end
			end,	
		},
		
		ScreenshotFromRadarBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 600, top = 228,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/sshotradar_e.dds"),
			downtexture = System:LoadImage("textures/gui/sshotradar_c.dds"),
			overtexture = System:LoadImage("textures/gui/sshotradar_a.dds"),
			texrect = "0 0 125 28",			

			OnCommand = function(Sender)
				local sel= UI.PageMyMenu.GUI.PlayerList:GetSelection(0);
				if (sel and UI.PageMyMenu.Playerk[sel-1]~="")then				
					local Plid = MyPlayers(UI.PageMyMenu.Playerk[sel-1]);
					if Plid~=-1 then
						Client:SendCommand("GSR "..Plid);
					end
				end
			end,	
		},

		PunishBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 600, top = 256,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/punish_e.dds"),
			downtexture = System:LoadImage("textures/gui/punish_c.dds"),
			overtexture = System:LoadImage("textures/gui/punish_a.dds"),
			texrect = "0 0 125 28",			

			OnCommand = function(Sender)
				local sel= UI.PageMyMenu.GUI.PlayerList:GetSelection(0);
				if (sel and UI.PageMyMenu.Playerk[sel-1]~="")then				
					local Plid = MyPlayers(UI.PageMyMenu.Playerk[sel-1]);
					if Plid~=-1 then
						local szReason = UI.PageMyMenu.GUI.ReasonEB:GetText();
						System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_punish "..Plid.." 5 "..szReason);
					end
				end
			end,	
		},
		
		ReasonText=
		{
			skin = UI.skins.Label,
			
			left = 530, top = 280,
			width = 122, 
			
			text = "Reason:";
		},
		
		ReasonEB=
		{
			skin = UI.skins.EditBox,
			
			left = 600, top = 300,
			width = 140,					
			fontsize = 12,
			tabstop = 10,
			maxlength = 50,
		},
		MiscBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 50, top = 340,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/Misc_e.dds"),
			downtexture = System:LoadImage("textures/gui/Misc_c.dds"),
			overtexture = System:LoadImage("textures/gui/Misc_a.dds"),
			texrect = "0 0 125 28",
			tabstop = 6,
			
			OnCommand = function(Sender)
				UI.PageMyMenu.GUI.HideListWindow();
				UI.PageMyMenu.GUI.DoGotFocusW();
			end,
		},
		
		KeepLockBtn=
		{
			skin = UI.skins.CheckBox,
			left = 175, top = 256,
			width = 120, height = 23,
			bordersides = "",
			color = "255 255 255 255",
			texture = System:LoadImage("textures/gui/keeplck_e.dds"),
			downtexture = System:LoadImage("textures/gui/keeplcke_e.dds"),
			overtexture = System:LoadImage("textures/gui/keeplck_a.dds"),
			texrect = "0 0 125 28",

			OnChanged = function(self)
				if(self:GetChecked()) then
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_keep_lock 1");
				else
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_keep_lock 0");
				end
				UI.PageMyMenu:RefreshVars();				
			end,
		},
		
		KeepScoreBtn=
		{
			skin = UI.skins.CheckBox,
			left = 175, top = 277,
			width = 120, height = 23,
			bordersides = "",
			color = "255 255 255 255",
			texture = System:LoadImage("textures/gui/keepscr_e.dds"),
			downtexture = System:LoadImage("textures/gui/keepscrc_e.dds"),
			overtexture = System:LoadImage("textures/gui/keepscr_a.dds"),
			texrect = "0 0 125 28",

			OnChanged = function(self)
				if(self:GetChecked()) then
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_keep_score 1");
				else
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_keep_score 0");
				end
				UI.PageMyMenu:RefreshVars();				
			end,
		},
		
		FulltimeBtn=
		{
			skin = UI.skins.CheckBox,
			left = 175, top = 298,
			width = 120, height = 23,
			bordersides = "",
			color = "255 255 255 255",
			texture = System:LoadImage("textures/gui/fulltime_e.dds"),
			downtexture = System:LoadImage("textures/gui/fulltimec_e.dds"),
			overtexture = System:LoadImage("textures/gui/fulltime_a.dds"),
			texrect = "0 0 125 28",

			OnChanged = function(self)
				if(self:GetChecked()) then
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_fulltime 1");
				else
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_fulltime 0");
				end
				UI.PageMyMenu:RefreshVars();				
			end,
		},
		
		SpectatorBtn=
		{
			skin = UI.skins.CheckBox,
			left = 175, top = 319,
			width = 120, height = 23,
			bordersides = "",
			color = "255 255 255 255",
			texture = System:LoadImage("textures/gui/spect_e.dds"),
			downtexture = System:LoadImage("textures/gui/spectc_e.dds"),
			overtexture = System:LoadImage("textures/gui/spect_a.dds"),
			texrect = "0 0 125 28",

			OnChanged = function(self)
				if(self:GetChecked()) then
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_allow_spectators 1");
				else
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_allow_spectators 0");
				end
				UI.PageMyMenu:RefreshVars();				
			end,
		},
		
		VotingBtn=
		{
			skin = UI.skins.CheckBox,
			left = 175, top = 340,
			width = 120, height = 23,
			bordersides = "",
			color = "255 255 255 255",
			texture = System:LoadImage("textures/gui/Voting_e.dds"),
			downtexture = System:LoadImage("textures/gui/Votingc_e.dds"),
			overtexture = System:LoadImage("textures/gui/Voting_a.dds"),
			texrect = "0 0 125 28",

			OnChanged = function(self)
				if(self:GetChecked()) then
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_allow_voting 1");
				else
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_allow_voting 0");
				end
				UI.PageMyMenu:RefreshVars();				
			end,
		},
		
		RLenableBtn=
		{
			skin = UI.skins.CheckBox,
			left = 175, top = 361,
			width = 120, height = 23,
			bordersides = "",
			color = "255 255 255 255",
			texture = System:LoadImage("textures/gui/RL_e.dds"),
			downtexture = System:LoadImage("textures/gui/RLc_e.dds"),
			overtexture = System:LoadImage("textures/gui/RL_a.dds"),
			texrect = "0 0 125 28",

			OnChanged = function(self)
				if(self:GetChecked()) then
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_Disable_SniperRL 0");
				else
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_Disable_SniperRL 1");
				end
				UI.PageMyMenu:RefreshVars();				
			end,
		},
		
		TKkickBtn=
		{
			skin = UI.skins.CheckBox,
			left = 175, top = 382,
			width = 120, height = 23,
			bordersides = "",
			color = "255 255 255 255",
			texture = System:LoadImage("textures/gui/TKkick_e.dds"),
			downtexture = System:LoadImage("textures/gui/TKkickc_e.dds"),
			overtexture = System:LoadImage("textures/gui/TKkick_a.dds"),
			texrect = "0 0 125 28",

			OnChanged = function(self)
				if(self:GetChecked()) then
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_allow_teamkilling 0");
				else
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_allow_teamkilling 1");
				end
				UI.PageMyMenu:RefreshVars();				
			end,
		},
		
		MaxPingkickBtn=
		{
			skin = UI.skins.CheckBox,
			left = 175, top = 403,
			width = 120, height = 23,
			bordersides = "",
			color = "255 255 255 255",
			texture = System:LoadImage("textures/gui/MaxPing_e.dds"),
			downtexture = System:LoadImage("textures/gui/MaxPingc_e.dds"),
			overtexture = System:LoadImage("textures/gui/MaxPing_a.dds"),
			texrect = "0 0 125 28",

			OnChanged = function(self)
				if(self:GetChecked()) then
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_max_average_ping 180");
				else
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_max_average_ping 0");
				end
				UI.PageMyMenu:RefreshVars();				
			end,
		},
		
		BadwordkickBtn=
		{
			skin = UI.skins.CheckBox,
			left = 175, top = 424,
			width = 120, height = 23,
			bordersides = "",
			color = "255 255 255 255",
			texture = System:LoadImage("textures/gui/Badword_e.dds"),
			downtexture = System:LoadImage("textures/gui/Badwordc_e.dds"),
			overtexture = System:LoadImage("textures/gui/Badword_a.dds"),
			texrect = "0 0 125 28",

			OnChanged = function(self)
				if(self:GetChecked()) then
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_bwk_enable 1");
				else
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_bwk_enable 0");
				end
				UI.PageMyMenu:RefreshVars();				
			end,
		},
		
		DiscardClipBtn=
		{
			skin = UI.skins.CheckBox,
			left = 175, top = 445,
			width = 120, height = 23,
			bordersides = "",
			color = "255 255 255 255",
			texture = System:LoadImage("textures/gui/discardclip_e.dds"),
			downtexture = System:LoadImage("textures/gui/discardclipc_e.dds"),
			overtexture = System:LoadImage("textures/gui/discardclip_a.dds"),
			texrect = "0 0 125 28",

			OnChanged = function(self)
				if(self:GetChecked()) then
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_discardclip 1");
				else
					System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gr_discardclip 0");
				end
				UI.PageMyMenu:RefreshVars();				
			end,
		},

		MapBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 50, top = 368,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/maps_e.dds"),
			downtexture = System:LoadImage("textures/gui/maps_c.dds"),
			overtexture = System:LoadImage("textures/gui/maps_a.dds"),
			texrect = "0 0 125 28",
			tabstop = 7,
			
			OnGotFocus = function(Sender)
				UI.PageMyMenu.GUI.HideListWindow();
				UI.PageMyMenu.GUI.DoLostFocusW();
				UI:ShowWidget("MapList", "MyMenu");
				UI:ShowWidget("GoMapBtn", "MyMenu");
				UI:ShowWidget("VoteMapBtn", "MyMenu");
				UI.PageMyMenu.GUI.MapList:OnChanged();
			end,
			
			OnLostFocus = function(Sender)
				UI:HideWidget("MapList", "MyMenu");
				UI:HideWidget("GoMapBtn", "MyMenu");
				UI:HideWidget("VoteMapBtn", "MyMenu");
			end,
		},
					
		NextMapBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 50, top = 396,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/Nextmap_e.dds"),
			downtexture = System:LoadImage("textures/gui/Nextmap_c.dds"),
			overtexture = System:LoadImage("textures/gui/Nextmap_a.dds"),
			texrect = "0 0 125 28",
			tabstop = 8,
			
			OnCommand = function(Sender)
				System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."gl_nextmap");
				Game:SendMessage("Switch");
			end,
		},
		
		RestartBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 50, top = 424,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/Restart_e.dds"),
			downtexture = System:LoadImage("textures/gui/Restart_c.dds"),
			overtexture = System:LoadImage("textures/gui/Restart_a.dds"),
			texrect = "0 0 125 28",
			tabstop = 9,
			
			OnCommand = function(Sender)
				System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."sv_restart");
				Game:SendMessage("Switch");
			end,
		},
		
		GoMapBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 450, top = 200,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/gomap_e.dds"),
			downtexture = System:LoadImage("textures/gui/gomap_c.dds"),
			overtexture = System:LoadImage("textures/gui/gomap_a.dds"),
			texrect = "0 0 125 28",
			
			OnCommand = function(Sender)
				local sel= UI.PageMyMenu.GUI.MapList:GetSelection(0);
					if sel then
						local mapname = UI.PageMyMenu.GUI.MapList:GetItem(sel);
						if mapname then
							System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon.."sv_changemap "..mapname);
							Game:SendMessage("Switch");
						end
					end
			end,
		},
		
		VoteMapBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 450, top = 228,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/votemap_e.dds"),
			downtexture = System:LoadImage("textures/gui/votemap_c.dds"),
			overtexture = System:LoadImage("textures/gui/votemap_a.dds"),
			texrect = "0 0 125 28",
			
			OnCommand = function(Sender)
				local sel= UI.PageMyMenu.GUI.MapList:GetSelection(0);
					if sel then
						local mapname = UI.PageMyMenu.GUI.MapList:GetItem(sel);
						if mapname then
							System:ExecuteCommand("callvote map "..mapname);
							Game:SendMessage("Switch");
						end
					end
			end,
		},
		
		PlayerList= 
		{	
			OnInit = function (Sender)
--				Sender:ClearColumns();
				Sender:AddColumn("", 18, UIALIGN_CENTER, "0 140 140 255", "0 0 0 0", nil, nil, 0, 0);
				Sender:AddColumn("Players", 180, UIALIGN_LEFT, "0 140 140 255", "0 0 0 0");
				Sender:AddImageList(UI.PageMyMenu.PlayerTypeIcon);
			end,
			
			OnChanged = function(self)
				if (self:GetSelection(0)) then
					UI:EnableWidget("JoinRedBtn", "MyMenu");
					UI:EnableWidget("JoinBlueBtn", "MyMenu");
					UI:EnableWidget("JoinSpectBtn", "MyMenu");
					UI:EnableWidget("KickBtn", "MyMenu");
					UI:EnableWidget("BanBtn", "MyMenu");
					UI:EnableWidget("ScreenshotBtn", "MyMenu");
					UI:EnableWidget("ScreenshotFromRadarBtn", "MyMenu");
					UI:EnableWidget("PunishBtn", "MyMenu");
				else
					UI:DisableWidget("JoinRedBtn", "MyMenu");
					UI:DisableWidget("JoinBlueBtn", "MyMenu");
					UI:DisableWidget("JoinSpectBtn", "MyMenu");
					UI:DisableWidget("KickBtn", "MyMenu");
					UI:DisableWidget("BanBtn", "MyMenu");
					UI:DisableWidget("ScreenshotBtn", "MyMenu");
					UI:DisableWidget("ScreenshotFromRadarBtn", "MyMenu");
					UI:DisableWidget("PunishBtn", "MyMenu");
				end
			end,
			
			skin = UI.skins.ListView,
			fontsize = 12,
			left = 200, top = 141,
			width = 200, height = 318,
			selectioncolor = " 0 160 160 255",
--			hscrollbar=
--			
--			{
--				skin = UI.skins.HScrollBar,
--			},	
		},
		
		MapList= 
		{
			skin = UI.skins.ListView,
			left = 200, top = 141,
			width = 200, height = 318,
			fontsize = 12,
			selectioncolor = " 0 160 160 255",
			vscrollbar =
			{
				skin = UI.skins.VScrollBar,			
			},
						
			OnChanged = function(Sender)
				if (Sender:GetSelection(0)) then
					UI:EnableWidget("GoMapBtn", "MyMenu");
					UI:EnableWidget("VoteMapBtn", "MyMenu");
				else
					UI:DisableWidget("GoMapBtn", "MyMenu");
					UI:DisableWidget("VoteMapBtn", "MyMenu");				
				end
			end,			
		},
		
		background=
		{
			classname = "static",
			left = 400, top = 130,
			width = 350, height = 350,
			
			color = UI.szMessageBoxScreenColor,
			
			zorder = -500,	-- must be above all
		},

		RightTopStatic=
		{
			skin = UI.skins.MenuBorder,
			
			left = 410, top = 140,
			width = 330, height = 300,
			
			zorder = -50,
		},
		
		RightBottomStatic=
		{
			skin = UI.skins.MenuBorder,
			
			left = 410, top = 300,
			width = 330, height = 100,
			bordersides = "lr",
			
			zorder = -50,
		},
		
		BottomStatic=
		{
			skin = UI.skins.MenuBorder,
			
			left = 410, top = 400,
			width = 330, height = 50,
			
			zorder = -50,
		},
		
		ServerNameText=
		{
			skin = UI.skins.Label,
			
			left = 400, top = 150,
			width = 122, 
			
			text = Localize("ServerName");
		},
		
		ServerName=
		{
			skin = UI.skins.EditBox,
			
			left = 530, top = 150,
			width = 190,					
			fontsize = 12,
			tabstop = 10,
		
			maxlength = 54,
		},

		ServerPasswordText=
		{
			skin = UI.skins.Label,
			
			left = 400, top = 185,
			width = 122, 
			
			text = Localize("ServerPassword"),		
		},
		
		ServerPassword=
		{
			skin = UI.skins.EditBox,
			
			left = 530, top = 185,
			width = 120,
			fontsize = 12,			
			tabstop = 11,

			maxlength = 8,
		},
		
		MaxTeamPlayersText=
		{
			skin = UI.skins.Label,
			
			left = 400, top = 220,
			width = 264, 
			
			text = Localize("MaxTeamPlayers");
		},

		MaxTeamPlayers=
		{
			skin = UI.skins.EditBox,
			
			halign = UIALIGN_CENTER,
			maxlength = 2,
			numeric = 1,
			disallow = ".",
			tabstop = 12,
			
			left = 670, top = 220,
			width = 38,
		},
		
		MinTeamPlayersText=
		{
			skin = UI.skins.Label,
			
			left = 400, top = 255,
			width = 264, 
			
			text = Localize("MinTeamPlayers");
		},

		MinTeamPlayers=
		{
			skin = UI.skins.EditBox,
			
			halign = UIALIGN_CENTER,
			maxlength = 2,
			numeric = 1,
			disallow = ".",
			tabstop = 13,
			
			left = 670, top = 255,
			width = 38,
		},
		MaxServerPlayersText=
		{
			skin = UI.skins.Label,
			
			left = 400, top = 290,
			width = 264, 
			
			text = Localize("MaxServerPlayers");
		},

		MaxServerPlayers=
		{
			skin = UI.skins.EditBox,
			
			halign = UIALIGN_CENTER,
			maxlength = 2,
			numeric = 1,
			disallow = ".",
			
			left = 670, top = 290,
			width = 38,
			
			tabstop = 14,
		},

		RespawnTimeText=
		{
			skin = UI.skins.Label,
			
			left = 400, top = 325,
			width = 264,
			
			text = Localize("RespawnTime"),
		},
		
		RespawnTime=
		{
			skin = UI.skins.EditBox,
			
			left = 670, top = 325,
			width = 42,
			
			halign = UIALIGN_CENTER,
			maxlength = 3,
			numeric = 1,
			disallow = ".",
			
			tabstop = 15,
		},
		
		thumbnail=
		{
			skin = UI.skins.MenuBorder,
			left = 420, top = 220,
			width = 87, height = 167,
			bordersides = "",
			texture = System:LoadImage("textures/gui/solder.dds"),
			color = "255 255 255 255",
			
		}, 
		ServerApplyBtn =
		{
			skin = UI.skins.TopMenuButton,
			left = 515, top = 410,
			width = 120, height = 23,
			bordersides = "",
			texture = System:LoadImage("textures/gui/Apply_e.dds"),
			downtexture = System:LoadImage("textures/gui/Apply_c.dds"),
			overtexture = System:LoadImage("textures/gui/Apply_a.dds"),
			texrect = "0 0 125 28",			

			OnCommand = function(Sender)
				local GUI = UI.PageMyMenu.GUI;
				local bOk = 1;
				local szServerName = GUI.ServerName:GetText();
				if (UI:IsWidgetVisible(GUI.ServerName) and (not szServerName or (strlen(szServerName) < 1))) then bOk = 0;	end
				local szServerPassword = GUI.ServerPassword:GetText();				
				local iMaxTeamPlayers = GUI.MaxTeamPlayers:GetText();
				if (UI:IsWidgetVisible(GUI.MaxTeamPlayers) and (not iMaxTeamPlayers or (strlen(iMaxTeamPlayers) < 1))) then bOk = 0;	end				
				local iMinTeamPlayers = GUI.MinTeamPlayers:GetText();
				if (UI:IsWidgetVisible(GUI.MinTeamPlayers) and (not iMinTeamPlayers or (strlen(iMinTeamPlayers) < 1))) then bOk = 0;	end				
				local iMaxServerPlayers = GUI.MaxServerPlayers:GetText();
				if (UI:IsWidgetVisible(GUI.MaxServerPlayers) and (not iMaxServerPlayers or (strlen(iMaxServerPlayers) < 1))) then bOk = 0;	end				
				local iRespawnTime = GUI.RespawnTime:GetText();
				if (UI:IsWidgetVisible(GUI.RespawnTime) and (not iRespawnTime or (strlen(iRespawnTime) < 1))) then bOk = 0;	end
				
				if (not bOk or (bOk == 0)) then
					UI.MessageBox("@Error", "@CreateServerFieldEmpty");
					return
				end
	
				GUI.DOVarI("gr_MaxTeamLimit", iMaxTeamPlayers);
				GUI.DOVarI("gr_MinTeamLimit", iMinTeamPlayers);
				GUI.DOVarI("sv_maxplayers", iMaxServerPlayers);
				GUI.DOVarI("gr_RespawnTime", iRespawnTime);
				GUI.DOVarI("gr_BackupRPTime", iRespawnTime);
				GUI.DOVarS("sv_name", szServerName);
				GUI.DOVarS("sv_password", szServerPassword);
				Game:SendMessage("Switch");
			end,	
		},


		OnActivate = function(Sender)
			UI:DeactivateScreen("BackScreen");
			if (Game:IsServer()) then		
				UI.PageMyMenu.GUI.dedcon = "";
			else UI.PageMyMenu.GUI.dedcon = "rcon ";				
			end
			
			UI.PageMyMenu.GUI.DoLostFocusW();
			UI.PageMyMenu.GUI.HideListWindow();
			UI.PageMyMenu:RefreshVars();			
			UI.PageMyMenu.GUI.MapList:Clear();
			Client:SendCommand("MLA");
			UI.PageMyMenu.GUI.ReasonEB:SetText("Use ur brain!");
			UI.PageMyMenu:RefreshPlayerList();
		end,
		
		OnDeactivate = function(Sender)
			setglobal("gr_mntgle", 0);
		end,
		
		OnUpdate = function(Sender)
			if (_time - UI.PageMyMenu.fRefreshingTime > 3) then
				UI.PageMyMenu:RefreshPlayerList();
			end
			if (_time - UI.PageMyMenu.fvarsRefreshingTime > 1) and (UI.PageMyMenu.ivarsEnabled == 1) then
				Client:SendCommand("GST");
				UI.PageMyMenu.ivarsEnabled = 0;
			end
		end,
		
		DoLostFocusW = function(Sender)
				UI:HideWidget("KeepLockBtn", "MyMenu");
				UI:HideWidget("KeepScoreBtn", "MyMenu");
				UI:HideWidget("FulltimeBtn", "MyMenu");
				UI:HideWidget("SpectatorBtn", "MyMenu");
				UI:HideWidget("VotingBtn", "MyMenu");
				UI:HideWidget("RLenableBtn", "MyMenu");
				UI:HideWidget("TKkickBtn", "MyMenu");
				UI:HideWidget("MaxPingkickBtn", "MyMenu");
				UI:HideWidget("BadwordkickBtn", "MyMenu");
				UI:HideWidget("DiscardClipBtn", "MyMenu");
				UI:HideWidget("RightTopStatic", "MyMenu");
				UI:HideWidget("RightBottomStatic", "MyMenu");
				UI:HideWidget("BottomStatic", "MyMenu");
				UI:HideWidget("ServerApplyBtn", "MyMenu");
				UI:HideWidget("ServerPasswordText", "MyMenu");
				UI:HideWidget("ServerNameText", "MyMenu");
				UI:HideWidget("ServerName", "MyMenu");
				UI:HideWidget("ServerPassword", "MyMenu");
				UI:HideWidget("background", "MyMenu");
				UI:HideWidget("MaxServerPlayersText", "MyMenu");
				UI:HideWidget("MaxServerPlayers", "MyMenu");
				UI:HideWidget("MaxTeamPlayersText", "MyMenu");
				UI:HideWidget("MaxTeamPlayers", "MyMenu");
				UI:HideWidget("MinTeamPlayersText", "MyMenu");
				UI:HideWidget("MinTeamPlayers", "MyMenu");
				UI:HideWidget("RespawnTimeText", "MyMenu");
				UI:HideWidget("RespawnTime", "MyMenu");
				UI:HideWidget("thumbnail", "MyMenu");
		end,
		
		DoGotFocusW = function(Sender)
				UI:ShowWidget("KeepLockBtn", "MyMenu");
				UI:ShowWidget("KeepScoreBtn", "MyMenu");
				UI:ShowWidget("FulltimeBtn", "MyMenu");
				UI:ShowWidget("SpectatorBtn", "MyMenu");
				UI:ShowWidget("VotingBtn", "MyMenu");
				UI:ShowWidget("RLenableBtn", "MyMenu");
				UI:ShowWidget("TKkickBtn", "MyMenu");
				UI:ShowWidget("MaxPingkickBtn", "MyMenu");
				UI:ShowWidget("BadwordkickBtn", "MyMenu");
				UI:ShowWidget("DiscardClipBtn", "MyMenu");
				UI:ShowWidget("RightTopStatic", "MyMenu");
				UI:ShowWidget("RightBottomStatic", "MyMenu");
				UI:ShowWidget("BottomStatic", "MyMenu");
				UI:ShowWidget("ServerApplyBtn", "MyMenu")
				UI:ShowWidget("ServerPasswordText", "MyMenu");
				UI:ShowWidget("ServerPassword", "MyMenu");
				UI:ShowWidget("background", "MyMenu");
				UI:ShowWidget("ServerNameText", "MyMenu");
				UI:ShowWidget("ServerName", "MyMenu");	
				UI:ShowWidget("MaxServerPlayersText", "MyMenu");
				UI:ShowWidget("MaxServerPlayers", "MyMenu");
				UI:ShowWidget("MaxTeamPlayersText", "MyMenu");
				UI:ShowWidget("MaxTeamPlayers", "MyMenu");
				UI:ShowWidget("MinTeamPlayersText", "MyMenu");
				UI:ShowWidget("MinTeamPlayers", "MyMenu");
				UI:ShowWidget("RespawnTimeText", "MyMenu");
				UI:ShowWidget("RespawnTime", "MyMenu");
				UI:ShowWidget("thumbnail", "MyMenu");
				Client:SendCommand("GSN");
				Client:SendCommand("GSD");
		end,
		
		HideListWindow = function (Sender)
				UI:HideWidget("PlayerList", "MyMenu");
				UI:HideWidget("JoinRedBtn", "MyMenu");
				UI:HideWidget("JoinBlueBtn", "MyMenu");
				UI:HideWidget("JoinSpectBtn", "MyMenu");
				UI:HideWidget("KickBtn", "MyMenu");
				UI:HideWidget("BanBtn", "MyMenu");
				UI:HideWidget("PunishBtn", "MyMenu");
				UI:HideWidget("ReasonText", "MyMenu");
				UI:HideWidget("ReasonEB", "MyMenu");
				UI:HideWidget("ScreenshotBtn", "MyMenu");
				UI:HideWidget("ScreenshotFromRadarBtn", "MyMenu");
		end,
				
		DOVarS = function (szVarName, szValue)
			if (szValue and (strlen(szValue))) then
				System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon..szVarName.." "..szValue);
			else
				System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon..szVarName.." "..format("%c%c",34,34));
			end
		end,
	
		DOVarI = function (szVarName, iValue)
			if (iValue) then
				local iVal=tonumber(iValue);
				if not iVal then
					iVal=0;
				end
				System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon..szVarName.." "..iVal);
			else
				System:ExecuteCommand(UI.PageMyMenu.GUI.dedcon..szVarName.."0");
			end
		end, 
	},
	RefreshVars = function(Sender)
		UI.PageMyMenu.fvarsRefreshingTime = _time;
		UI.PageMyMenu.ivarsEnabled = 1;
	end,
	
	RefreshPlayerList = function(Sender)
		local Pname;
		local sel= UI.PageMyMenu.GUI.PlayerList:GetSelection(0);
		if (sel and UI.PageMyMenu.Playerk[sel-1]~="")then				
			Pname = UI.PageMyMenu.Playerk[sel-1];
		end		
		UI.PageMyMenu.GUI.PlayerList:Clear();
		UI.PageMyMenu.Playerk={};
		if not ClientStuff.idScoreboard then
			UI.PageMyMenu.GUI.PlayerList:AddItem("Error: ASSAULT idScoreboard is nil");
			return;
		end 
		local SBEntityEnt = System:GetEntity(ClientStuff.idScoreboard);
		local SBEntity = SBEntityEnt.cnt;
		local iY,X;
		local iLines=SBEntity:GetLineCount()-1;
		
		for iY=0, iLines do
			local idThisClient = SBEntity:GetEntryXY(ScoreboardTableColumns.ClientID,iY)-1;
			
			if idThisClient~=-1 then				
				UI.PageMyMenu.Playerk[iY]=SBEntity:GetEntryXY(ScoreboardTableColumns.sName,iY);
				local iTeam=SBEntity:GetEntryFloatXY(ScoreboardTableColumns.iPlayerTeam,iY); 
				local iPlayerClass=SBEntity:GetEntryFloatXY(ScoreboardTableColumns.iPlayerClass,iY);								
				local PlayerIndex = UI.PageMyMenu.GUI.PlayerList:AddItem("", UI.PageMyMenu.Playerk[iY]);				
				if iTeam==1 then	-- red team
					if iPlayerClass==1 then
						UI.PageMyMenu.GUI.PlayerList:SetItemImage(1, PlayerIndex, 0);
					elseif iPlayerClass==2 then
						UI.PageMyMenu.GUI.PlayerList:SetItemImage(2, PlayerIndex, 0);
					else
						UI.PageMyMenu.GUI.PlayerList:SetItemImage(3, PlayerIndex, 0);
					end
				elseif iTeam==2 then	-- blue team
					if iPlayerClass==1 then
						UI.PageMyMenu.GUI.PlayerList:SetItemImage(5, PlayerIndex, 0);
					elseif iPlayerClass==2 then
						UI.PageMyMenu.GUI.PlayerList:SetItemImage(6, PlayerIndex, 0);
					else
						UI.PageMyMenu.GUI.PlayerList:SetItemImage(7, PlayerIndex, 0);
					end
				else 	UI.PageMyMenu.GUI.PlayerList:SetItemImage(4, PlayerIndex, 0);
				end
			else	UI.PageMyMenu.Playerk[iY]="$8  ---=== empty slot ===---";
				local PlayerIndex = UI.PageMyMenu.GUI.PlayerList:AddItem("", UI.PageMyMenu.Playerk[iY]);
--				UI.PageMyMenu.GUI.PlayerList:SetItemImage(4, PlayerIndex, 0);			
			end
		end
		UI.PageMyMenu.fRefreshingTime = _time;
		if (sel and (sel <= UI.PageMyMenu.GUI.PlayerList:GetItemCount())) then 
			if (Pname == UI.PageMyMenu.Playerk[sel-1]) then 
				UI.PageMyMenu.GUI.PlayerList:SelectIndex(sel);
			end
		end
		UI.PageMyMenu.GUI.PlayerList:OnChanged();
	end
};

UI:CreateScreenFromTable("MyMenu",UI.PageMyMenu.GUI);