#include "ui/menudef.h"
#include "ui/menumacros.h"

// Defines //
#define WINDOW_X		16
#define WINDOW_Y		16
#define WINDOW_WIDTH	608
#define WINDOW_HEIGHT	448
#define GROUP_NAME		"grpPlayOnline"

// System Menu //
menuDef {
	name		"playonline"
	visible		0
	fullscreen	0
	rect		WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT
	style		WINDOW_STYLE_FILLED

	onOpen {

		// sort by servername ?
		conditionalScript serversort_0 2
		( "setitemcolor grpColumns backcolor 0 0 0 0 ; setitemcolor grpTabs backcolor .1 .1 .1 .3 ; setitemcolor grpTabs forecolor .6 .6 .6 1 ; setitemcolor serverColumn backcolor .35 .35 .35 .2 ; setitemcolor serverColumnTab backcolor .35 .35 .35 .2 ; setitemcolor serverColumnTab forecolor .9 .9 .9 1" )
		( "clearFocus" )

		// sort by mapname ?
		conditionalScript serversort_1 2
		( "setitemcolor grpColumns backcolor 0 0 0 0 ; setitemcolor grpTabs backcolor .1 .1 .1 .3 ; setitemcolor grpTabs forecolor .6 .6 .6 1 ; setitemcolor mapColumn backcolor .35 .35 .35 .2 ; setitemcolor mapColumnTab backcolor .35 .35 .35 .2 ; setitemcolor mapColumnTab forecolor .9 .9 .9 1" )
		( "clearFocus" )

		// sort by playercount ?
		conditionalScript serversort_2 2
		( "setitemcolor grpColumns backcolor 0 0 0 0 ; setitemcolor grpTabs backcolor .1 .1 .1 .3 ; setitemcolor grpTabs forecolor .6 .6 .6 1 ;	setitemcolor playerColumn backcolor .35 .35 .35 .2 ; setitemcolor playerColumnTab backcolor .35 .35 .35 .2 ; setitemcolor playerColumnTab forecolor .9 .9 .9 1" )
		( "clearFocus" )

		// sort by gametype ?
		conditionalScript serversort_3 2
		( "setitemcolor grpColumns backcolor 0 0 0 0 ; setitemcolor grpTabs backcolor .1 .1 .1 .3 ; setitemcolor grpTabs forecolor .6 .6 .6 1 ; setitemcolor gametypeColumn backcolor .35 .35 .35 .2 ; setitemcolor gametypeColumnTab backcolor .35 .35 .35 .2 ; setitemcolor gametypeColumnTab forecolor .9 .9 .9 1" )
		( "clearFocus" )

		// sort by ping ?
		conditionalScript serversort_4 2
		( "setitemcolor grpColumns backcolor 0 0 0 0 ; setitemcolor grpTabs backcolor .1 .1 .1 .3 ; setitemcolor grpTabs forecolor .6 .6 .6 1 ; setitemcolor pingColumn backcolor .35 .35 .35 .2 ; setitemcolor pingColumnTab backcolor .35 .35 .35 .2 ; setitemcolor pingColumnTab forecolor .9 .9 .9 1" )
		( "clearFocus" )

		clearCvar ui_filterdescription
	}

	onESC {
		uiScript ServerSort 2 ;
		uiScript closeJoin ;
		close playonline ;
		open main
	}

// Window //
	WINDOW( _("PLAY"), 146 )

// Subwindows //
	#define SUBWINDOW_WIDTH		WINDOW_WIDTH-12

// Filters //
	#define FILTERS_WIDTH		.75*WINDOW_WIDTH

	SUBWINDOW( 6, 32, (FILTERS_WIDTH), 28, _("MESSAGE OF THE DAY") )
	itemDef {
		name			"messageOfTheDay"
		group			GROUP_NAME
		rect			4 48 $evalfloat((FILTERS_WIDTH)-4) 10
		ownerDraw		UI_SERVERMOTD
		textfont		UI_FONT_COURBD_21
		textstyle		ITEM_TEXTSTYLE_SHADOWED
		textscale		.2
		textalignx		4
		textaligny		8
		forecolor		.6 .6 .6 1
		visible			1
		decoration
	}

	SUBWINDOW( 6, 64, (FILTERS_WIDTH), 94, _("FILTERS") )

	BUTTONEXT( FILTERS_WIDTH-.16*FILTERS_WIDTH, 66, .16*(FILTERS_WIDTH-6), 12, _("RESET"), .20, 9, uiScript ResetFilters; uiScript RefreshFilter, tooltip _("Reset all filters to their defaults"))

// Buttons
	BUTTONEXT( 12, 84, .33*(FILTERS_WIDTH-24), 14, _("INTERNET"), .24, 11, uiScript ResetInternet; uiScript RefreshServers, tooltip _("Show all Internet servers"))
	BUTTONEXT( 8+(.34*(FILTERS_WIDTH-24))+6, 84, .34*(FILTERS_WIDTH-24), 14, _("FAVORITES"), .24, 11, uiScript ResetFavorites; uiScript RefreshFilter, tooltip _("Show all favorite servers"))
	BUTTONEXT( 18+(.67*(FILTERS_WIDTH-24))+6, 84, .33*(FILTERS_WIDTH-24), 14, _("LOCAL"), .24, 11, uiScript ResetLocal; uiScript RefreshFilter, tooltip _("Show all local servers"))

	MULTIACTIONLEFT( 12, 102, .33*(FILTERS_WIDTH-24), 10, _("Source:"), .2, 8, "ui_netSource", cvarFloatList { "^5Local" 0 "^2Internet" 1 "^3Favorites" 2 }, uiScript UpdateFilter, _("Choose the type of game servers to display from Internet, local and the favorites list"))
	MULTIACTIONLEFT( 12, 114, .33*(FILTERS_WIDTH-24), 10, _("Game Type:"), .2, 8, "ui_joinGameType", cvarFloatList { "All" -1 "Objective" 2 "Stopwatch" 3 "Campaign" 4 "LMS" 5 "Map Voting" 6 }, uiScript RefreshFilter, _("Display only game servers offering this Game Type") )
	MULTIACTIONLEFT( 12, 126, .33*(FILTERS_WIDTH-24), 10, _("Mod:"), .2, 8, "ui_browserModFilter", cvarFloatList { "All" 0 "Legacy" 1 "ETPub" 2 "Jaymod" 3 "NoQuarter" 4 "N!tmod" 5 "silEnT" 6 "True Combat" 7 "ETNam" 8 "ETrun" 9 "ETJump" 10 "TJMod" 11 "Original" 12 "Other" -1 }, uiScript UpdateFilter, _("Display only game servers offering this Mod") )

	itemDef {
		name		"filtericonMapName"
		rect		12 138 10 10
		style		WINDOW_STYLE_SHADER
		background	"ui/assets/filter_map"
		forecolor	1 1 1 1
		visible		1
		decoration
	}
	TRICHECKBOXACTIONMULTI( 12+12, 138, 10, 10, .2, 8, "ui_browserServerNameFilterCheckBox",  cvarFloatList { "" 0 "" 1 "" 2 }, uiScript RefreshFilter ; setcvar ui_filterdescription _("Filter affecting servers with specific name"), _("Include or exclude servers with desired server name from the server list") )
	EDITFIELDSIMPLE( 12+24, 138, .33*(FILTERS_WIDTH-12)-28, 10, "", .2, 8, "ui_browserMapFilter", 25, 25, uiScript RefreshFilter, _("Include or exclude servers with desired server name from the server list") )

	itemDef {
		name		"filtericonEmptyFull"
		rect		$evalfloat(8+.33*(FILTERS_WIDTH-6)+2+2) 102 10 10
		style		WINDOW_STYLE_SHADER
		background	"ui/assets/filter_emptyfull"
		forecolor	1 1 1 1
		visible		1
		decoration
	}
	TRICHECKBOXACTIONMULTI( 8+.33*(FILTERS_WIDTH-6)+2+2+12, 102, .34*(FILTERS_WIDTH-6)-18, 10, .2, 8, "ui_browserShowEmptyOrFull", cvarFloatList { "Filter Disabled" 0 "Empty only..." 1 "Not empty..." 2 }, uiScript RefreshFilter ; setcvar ui_filterdescription "Filter affecting Empty and Full Servers", "Include or exclude empty and full servers from the server list"  )

	itemDef {
		name		"filtericonPassword"
		rect		$evalfloat(8+.33*(FILTERS_WIDTH-6)+2+2) 114 10 10
		style		WINDOW_STYLE_SHADER
		background	"ui/assets/filter_pass"
		forecolor	1 1 1 1
		visible		1
		decoration
	}
	TRICHECKBOXACTIONMULTI( 8+.33*(FILTERS_WIDTH-6)+2+2+12, 114, .34*(FILTERS_WIDTH-6)-18, 10, .2, 8, "ui_browserShowPasswordProtected", cvarFloatList { "Filter Disabled" 0 "Requires password..." 1 "No password..." 2 }, uiScript RefreshFilter ; setcvar ui_filterdescription "Filter affecting Password Protected Servers", "Include or exclude password protected servers from the server list" )

	itemDef {
		name		"filtericonFriendlyFire"
		rect		$evalfloat(8+.33*((FILTERS_WIDTH)-6)+2+2) 126 10 10
		style		WINDOW_STYLE_SHADER
		background	"ui/assets/filter_ff"
		forecolor	1 1 1 1
		visible		1
		decoration
	}
	TRICHECKBOXACTIONMULTI( 8+.33*(FILTERS_WIDTH-6)+2+2+12, 126, .34*(FILTERS_WIDTH-6)-18, 10, .2, 8, "ui_browserShowFriendlyFire", cvarFloatList { "Filter Disabled" 0 "Friendly fire..." 1 "No friendly fire..." 2 }, uiScript RefreshFilter ; setcvar ui_filterdescription "Filter affecting Servers with Friendly Fire", "Include or exclude servers where team mates can damage each other from the server list"  )

	itemDef {
		name		"filtericonMaxLives"
		rect		$evalfloat(8+.33*(FILTERS_WIDTH-6)+2+2) 138 10 10
		style		WINDOW_STYLE_SHADER
		background	"ui/assets/filter_lives"
		forecolor	1 1 1 1
		visible		1
		decoration
	}
	TRICHECKBOXACTIONMULTI( 8+.33*(FILTERS_WIDTH-6)+2+2+12, 138, .34*(FILTERS_WIDTH-6)-18, 10, .2, 8, "ui_browserShowMaxlives", cvarFloatList { "Filter Disabled" 0 "With max lives..." 1 "Without max lives..." 2 }, uiScript RefreshFilter ; setcvar ui_filterdescription "Filter affecting Servers with Max Lives", "Include or exclude servers that limit the number of player lives per match from the server list" )

	itemDef {
		name		"filtericonWeapRestrict"
		rect		$evalfloat(8+.67*(FILTERS_WIDTH-6)+2+2) 102 10 10
		style		WINDOW_STYLE_SHADER
		background	"ui/assets/filter_weap"
		forecolor	1 1 1 1
		visible		1
		decoration
	}
	TRICHECKBOXACTIONMULTI( 8+.67*(FILTERS_WIDTH-6)+2+2+12, 102, .33*(FILTERS_WIDTH-6)-18, 10, .2, 8, "ui_browserShowWeaponsRestricted", cvarFloatList { "Filter Disabled" 0 "No weapon limits..." 1 "Weapon limits..." 2 }, uiScript RefreshFilter ; setcvar ui_filterdescription "Filter affecting Servers with Weapon Restrictions", "Include or exclude servers that limit the number of\n available heavy weapons from the server list" )

	itemDef {
		name		"filtericonAntilag"
		rect		$evalfloat(8+.67*(FILTERS_WIDTH-6)+2+2) 114 10 10
		style		WINDOW_STYLE_SHADER
		background	"ui/assets/filter_antilag"
		forecolor	1 1 1 1
		visible		1
		decoration
	}
	TRICHECKBOXACTIONMULTI( 8+.67*(FILTERS_WIDTH-6)+2+2+12, 114, .33*(FILTERS_WIDTH-6)-18, 10, .2, 8, "ui_browserShowAntilag", cvarFloatList { "Filter Disabled" 0 "With antilag..." 1 "Without antilag..." 2 }, uiScript RefreshFilter ; setcvar ui_filterdescription "Filter affecting Anti-Lag Servers", "Include or exclude servers with anti-lag support from the server list" )

	itemDef {
		name		"filtericonTeamBalance"
		rect		$evalfloat(8+.67*((FILTERS_WIDTH)-6)+2+2) 126 10 10
		style		WINDOW_STYLE_SHADER
		background	"ui/assets/filter_balance"
		forecolor	1 1 1 1
		visible		1
		decoration
	}
	TRICHECKBOXACTIONMULTI( 8+.67*(FILTERS_WIDTH-6)+2+2+12, 126, .33*(FILTERS_WIDTH-6)-18, 10, .2, 8, "ui_browserShowTeamBalanced", cvarFloatList { "Filter Disabled" 0 "Balanced only..." 1 "Unbalanced only..." 2 }, uiScript RefreshFilter ; setcvar ui_filterdescription "Filter affecting Servers with Force Team Balance", "Include or exclude servers that enforce balanced teams from the server list" )

	itemDef {
		name		"filtericonBots"
		rect		$evalfloat(8+.67*((FILTERS_WIDTH)-6)+2+2) 138 10 10
		style		WINDOW_STYLE_SHADER
		background	"ui/assets/filter_bots"
		forecolor	1 1 1 1
		visible		1
		decoration
	}
	TRICHECKBOXACTIONMULTI( 8+.67*(FILTERS_WIDTH-6)+2+2+12, 138, .33*(FILTERS_WIDTH-6)-18, 10, .2, 8, "ui_browserShowHumans", cvarFloatList { "Filter Disabled" 0 "With humans..." 1 "Without humans..." 2 }, uiScript RefreshFilter ; setcvar ui_filterdescription "Filter affecting ET: Legacy Servers with Humans players", "Include or exclude ET: Legacy servers with humans from the server list" )

	/*
	itemDef {
		name			"descriptionFilters"
		group			GROUP_NAME
		rect			10 140 $evalfloat((FILTERS_WIDTH)-8) 16
		style			WINDOW_STYLE_FILLED
		type			ITEM_TYPE_TEXT
		textfont		UI_FONT_COURBD_21
		textstyle		ITEM_TEXTSTYLE_SHADOWED
		textscale		.2
		textalignx		4
		textaligny		11
		forecolor		.6 .6 .6 1
		backcolor		0 0 0 .2
		cvar			ui_filterdescription
		border			WINDOW_BORDER_FULL
		bordercolor		.5 .5 .5 .5
		visible			1
		decoration
	}
	*/

	SUBWINDOW( 6+FILTERS_WIDTH+4, 32, (SUBWINDOW_WIDTH-FILTERS_WIDTH-4), 126, _("PREVIEW") )
	itemDef {
		name		"mapPreview"
		group		GROUP_NAME
		rect		$evalfloat(6+FILTERS_WIDTH+4+2) $evalfloat(32+16) $evalfloat(SUBWINDOW_WIDTH-FILTERS_WIDTH-4-4) $evalfloat(.75*(SUBWINDOW_WIDTH-FILTERS_WIDTH-4-4))
		style		WINDOW_STYLE_FILLED
		ownerdraw	UI_NETMAPPREVIEW
		backcolor	0 0 0 .5
		border		WINDOW_BORDER_FULL
		bordercolor	.1 .1 .1 .2
		visible		1
		decoration
	}

// Server Browser //
	SUBWINDOW( 6, 162, (SUBWINDOW_WIDTH), 256, _("SERVER BROWSER") )

	BUTTONEXT( SUBWINDOW_WIDTH-.16*FILTERS_WIDTH, 164, .16*(FILTERS_WIDTH-6), 12, _("REFRESH"), .20, 9, uiScript RefreshFilter, tooltip _("Refresh servers list"))

	itemDef {
		name       "serverFilterLabel"
		group      GROUP_NAME
		rect       $evalfloat(SUBWINDOW_WIDTH-.16*FILTERS_WIDTH-6) 165 584 12
		type       ITEM_TYPE_TEXT
		textfont   UI_FONT_ARIBLK_27
		// textstyle  ITEM_TEXTSTYLE_SHADOWED
		textscale  .19
		textalign  ITEM_ALIGN_RIGHT
		textalignx 0
		textaligny 8
		forecolor  .6 .6 .6 1
		cvar       "ui_tmp_ServersFiltered"
		visible    1
		decoration
		autowrapped
	}

// Rows

	itemDef {
		name		"row1"
		group		GROUP_NAME
		rect		12 208 $evalfloat((SUBWINDOW_WIDTH)-12-18) 12
		style		WINDOW_STYLE_FILLED
		backcolor	.2 .2 .2 .4
		visible		1
		decoration
	}

	itemDef {
		name		"row2"
		group		GROUP_NAME
		rect		12 232 $evalfloat((SUBWINDOW_WIDTH)-12-18) 12
		style		WINDOW_STYLE_FILLED
		backcolor	.2 .2 .2 .4
		visible		1
		decoration
	}

	itemDef {
		name		"row3"
		group		GROUP_NAME
		rect		12 256 $evalfloat((SUBWINDOW_WIDTH)-12-18) 12
		style		WINDOW_STYLE_FILLED
		backcolor	.2 .2 .2 .4
		visible		1
		decoration
	}

	itemDef {
		name		"row4"
		group		GROUP_NAME
		rect		12 280 $evalfloat((SUBWINDOW_WIDTH)-12-18) 12
		style		WINDOW_STYLE_FILLED
		backcolor	.2 .2 .2 .4
		visible		1
		decoration
	}

	itemDef {
		name		"row5"
		group		GROUP_NAME
		rect		12 304 $evalfloat((SUBWINDOW_WIDTH)-12-18) 12
		style		WINDOW_STYLE_FILLED
		backcolor	.2 .2 .2 .4
		visible		1
		decoration
	}

	itemDef {
		name		"row6"
		group		GROUP_NAME
		rect		12 328 $evalfloat((SUBWINDOW_WIDTH)-12-18) 12
		style		WINDOW_STYLE_FILLED
		backcolor	.2 .2 .2 .4
		visible		1
		decoration
	}

	itemDef {
		name		"row7"
		group		GROUP_NAME
		rect		12 352 $evalfloat((SUBWINDOW_WIDTH)-12-18) 12
		style		WINDOW_STYLE_FILLED
		backcolor	.2 .2 .2 .4
		visible		1
		decoration
	}

	itemDef {
		name		"row8"
		group		GROUP_NAME
		rect		12 376 $evalfloat((SUBWINDOW_WIDTH)-12-18) 12
		style		WINDOW_STYLE_FILLED
		backcolor	.2 .2 .2 .2
		visible		1
		decoration
	}

// Columns and sort tabs

#define COLUMN_HEIGHT		194
#define SERVERNAME_WIDTH	220
#define MAPNAME_WIDTH		88
#define PLAYERS_WIDTH		80
#define GAMETYPE_WIDTH		48
#define PING_WIDTH			34

	itemDef {
		name		"serverColumnTab"
		group		"grpTabs"
		rect		12 180 $evalfloat(SERVERNAME_WIDTH+1) 16
		type		ITEM_TYPE_BUTTON
		text		_("SERVER NAME")
		textfont	UI_FONT_ARIBLK_27
		textscale	.19
		textalignx	4
		textaligny	12
		style		WINDOW_STYLE_FILLED
		backcolor	.1 .1 .1 .3
		forecolor	.6 .6 .6 1
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		tooltip		_("Click here to sort by Server Name")

		action {
			setitemcolor "grpColumns" backcolor 0 0 0 0;
			setitemcolor "grpTabs" backcolor .1 .1 .1 .3 ;
			setitemcolor "grpTabs" forecolor .6 .6 .6 1 ;
			setitemcolor "serverColumn" backcolor .35 .35 .35 .2 ;
			setitemcolor "serverColumnTab" backcolor .35 .35 .35 .2 ;
			setitemcolor "serverColumnTab" forecolor .9 .9 .9 1 ;
			uiScript ServerSort 0
		}
	}

	itemDef {
		name		"serverColumn"
		group		"grpColumns"
		rect		12 195 $evalfloat(SERVERNAME_WIDTH+1) COLUMN_HEIGHT
		style		WINDOW_STYLE_FILLED
		backcolor	0 0 0 0
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		decoration
	}

	itemDef {
		name		"mapColumnTab"
		group		"grpTabs"
		rect		$evalfloat(12+SERVERNAME_WIDTH) 180 $evalfloat(MAPNAME_WIDTH+1) 16
		type		ITEM_TYPE_BUTTON
		text		_("MAP NAME")
		textfont	UI_FONT_ARIBLK_27
		textscale	.19
		textalignx	4
		textaligny	12
		style		WINDOW_STYLE_FILLED
		backcolor	.1 .1 .1 .3
		forecolor	.6 .6 .6 1
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		tooltip		_("Click here to sort by Campaign or Map name")

		action {
			setitemcolor "grpColumns" backcolor 0 0 0 0;
			setitemcolor "grpTabs" backcolor .1 .1 .1 .3 ;
			setitemcolor "grpTabs" forecolor .6 .6 .6 1 ;
			setitemcolor "mapColumn" backcolor .35 .35 .35 .2 ;
			setitemcolor "mapColumnTab" backcolor .35 .35 .35 .2 ;
			setitemcolor "mapColumnTab" forecolor .9 .9 .9 1 ;
			uiScript ServerSort 1
		}
	}

	itemDef {
		name		"mapColumn"
		group		"grpColumns"
		rect		$evalfloat(12+SERVERNAME_WIDTH) 195 $evalfloat(MAPNAME_WIDTH+1) COLUMN_HEIGHT
		style		WINDOW_STYLE_FILLED
		backcolor	0 0 0 0
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		decoration
	}

	itemDef {
		name		"playerColumnTab"
		group		"grpTabs"
		rect		$evalfloat(12+SERVERNAME_WIDTH+MAPNAME_WIDTH) 180 $evalfloat(PLAYERS_WIDTH+1) 16
		type		ITEM_TYPE_BUTTON
		text		_("#PLAYERS")
		textfont	UI_FONT_ARIBLK_27
		textscale	.19
		textalignx	4
		textaligny	12
		style		WINDOW_STYLE_FILLED
		backcolor	.1 .1 .1 .3
		forecolor	.6 .6 .6 1
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		tooltip		_("Click here to sort by Player Count")

		action {
			setitemcolor "grpColumns" backcolor 0 0 0 0;
			setitemcolor "grpTabs" backcolor .1 .1 .1 .3 ;
			setitemcolor "grpTabs" forecolor .6 .6 .6 1 ;
			setitemcolor "playerColumn" backcolor .35 .35 .35 .2 ;
			setitemcolor "playerColumnTab" backcolor .35 .35 .35 .2 ;
			setitemcolor "playerColumnTab" forecolor .9 .9 .9 1 ;
			uiScript ServerSort 2
		}
	}

	itemDef {
		name		"playerColumn"
		group		"grpColumns"
		rect		$evalfloat(12+SERVERNAME_WIDTH+MAPNAME_WIDTH) 195 $evalfloat(PLAYERS_WIDTH+1) COLUMN_HEIGHT
		style		WINDOW_STYLE_FILLED
		backcolor	0 0 0 0
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		decoration
	}

	itemDef {
		name		"gametypeColumnTab"
		group		"grpTabs"
		rect		$evalfloat(12+SERVERNAME_WIDTH+MAPNAME_WIDTH+PLAYERS_WIDTH) 180 $evalfloat(GAMETYPE_WIDTH+1) 16
		type		ITEM_TYPE_BUTTON
		text		_("TYPE")
		textfont	UI_FONT_ARIBLK_27
		textscale	.19
		textalignx	4
		textaligny	12
		style		WINDOW_STYLE_FILLED
		backcolor	.1 .1 .1 .3
		forecolor	.6 .6 .6 1
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		tooltip		_("Click here to sort by Game Type")

		action {
			setitemcolor "grpColumns" backcolor 0 0 0 0;
			setitemcolor "grpTabs" backcolor .1 .1 .1 .3 ;
			setitemcolor "grpTabs" forecolor .6 .6 .6 1 ;
			setitemcolor "gametypeColumn" backcolor .35 .35 .35 .2 ;
			setitemcolor "gametypeColumnTab" backcolor .35 .35 .35 .2 ;
			setitemcolor "gametypeColumnTab" forecolor .9 .9 .9 1 ;
			uiScript ServerSort 3
		}
	}

	itemDef {
		name		"gametypeColumn"
		group		"grpColumns"
		rect		$evalfloat(12+SERVERNAME_WIDTH+MAPNAME_WIDTH+PLAYERS_WIDTH) 195 $evalfloat(GAMETYPE_WIDTH+1) COLUMN_HEIGHT
		style		WINDOW_STYLE_FILLED
		backcolor	0 0 0 0
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		decoration
	}

	itemDef {
		name		"pingColumnTab"
		group		"grpTabs"
		rect		$evalfloat(12+SERVERNAME_WIDTH+MAPNAME_WIDTH+PLAYERS_WIDTH+GAMETYPE_WIDTH) 180 $evalfloat(PING_WIDTH+1) 16
		type		ITEM_TYPE_BUTTON
		text		_("PING")
		textfont	UI_FONT_ARIBLK_27
		textscale	.19
		textalignx	4
		textaligny	12
		style		WINDOW_STYLE_FILLED
		backcolor	.1 .1 .1 .3
		forecolor	.6 .6 .6 1
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		tooltip		"Click here to sort by Ping"

		action {
			setitemcolor "grpColumns" backcolor 0 0 0 0;
			setitemcolor "grpTabs" backcolor .1 .1 .1 .3 ;
			setitemcolor "grpTabs" forecolor .6 .6 .6 1 ;
			setitemcolor "pingColumn" backcolor .35 .35 .35 .2 ;
			setitemcolor "pingColumnTab" backcolor .35 .35 .35 .2 ;
			setitemcolor "pingColumnTab" forecolor .9 .9 .9 1 ;
			uiScript ServerSort 4
		}
	}

	itemDef {
		name		"pingColumn"
		group		"grpColumns"
		rect		$evalfloat(12+SERVERNAME_WIDTH+MAPNAME_WIDTH+PLAYERS_WIDTH+GAMETYPE_WIDTH) 195 $evalfloat(PING_WIDTH+1) COLUMN_HEIGHT
		style		WINDOW_STYLE_FILLED
		backcolor	0 0 0 0
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		decoration
	}

	itemDef {
		name		"filtersColumnTab"
		group		GROUP_NAME
		rect		$evalfloat(12+SERVERNAME_WIDTH+MAPNAME_WIDTH+PLAYERS_WIDTH+GAMETYPE_WIDTH+PING_WIDTH) 180 $evalfloat(84+1) 16
		type		ITEM_TYPE_TEXT
		text		"FILTERS"
		textfont	UI_FONT_ARIBLK_27
		textscale	.19
		textalignx	4
		textaligny	12
		style		WINDOW_STYLE_FILLED
		backcolor	.1 .1 .1 .3
		forecolor	.6 .6 .6 1
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		decoration
	}

	itemDef {
		name		"filtersColumn"
		group		GROUP_NAME
		rect		$evalfloat(12+SERVERNAME_WIDTH+MAPNAME_WIDTH+PLAYERS_WIDTH+GAMETYPE_WIDTH+PING_WIDTH) 195 $evalfloat(84+1) COLUMN_HEIGHT
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		decoration
	}

	itemDef {
		name		"favouritesColumnTab"
		group		GROUP_NAME
		rect		$evalfloat(12+SERVERNAME_WIDTH+MAPNAME_WIDTH+PLAYERS_WIDTH+GAMETYPE_WIDTH+PING_WIDTH+84) 180 $evalfloat(12+16+1) 16
		type		ITEM_TYPE_TEXT
		text		"FAV"
		textfont	UI_FONT_ARIBLK_27
		textscale	.19
		textalignx	4
		textaligny	12
		style		WINDOW_STYLE_FILLED
		backcolor	.1 .1 .1 .3
		forecolor	.6 .6 .6 1
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		decoration
	}

	itemDef {
		name		"favouritesColumn"
		group		GROUP_NAME
		rect		$evalfloat(12+SERVERNAME_WIDTH+MAPNAME_WIDTH+PLAYERS_WIDTH+GAMETYPE_WIDTH+PING_WIDTH+84) 195 12 COLUMN_HEIGHT
		border		WINDOW_BORDER_FULL
		bordercolor	.5 .5 .5 .5
		visible		1
		decoration
	}

	// Server List

	itemDef {
		name			"serverList"
		group			GROUP_NAME
		rect			12 196 $evalfloat((SUBWINDOW_WIDTH)-12) $evalfloat(COLUMN_HEIGHT-1)
		type			ITEM_TYPE_LISTBOX
		textfont		UI_FONT_COURBD_21
		textstyle		ITEM_TEXTSTYLE_SHADOWED
		textscale		.2
		textaligny		-3
		forecolor		.6 .6 .6 1
		outlinecolor	.5 .5 .5 .4
		feeder			FEEDER_SERVERS
		elementtype		LISTBOX_TEXT
		elementwidth	$evalfloat((SUBWINDOW_WIDTH)-12)
		elementheight	12
		columns			7	0 SERVERNAME_WIDTH 38
							$evalfloat(SERVERNAME_WIDTH) MAPNAME_WIDTH 13
							$evalfloat(SERVERNAME_WIDTH+MAPNAME_WIDTH) PLAYERS_WIDTH 13
							$evalfloat(SERVERNAME_WIDTH+MAPNAME_WIDTH+PLAYERS_WIDTH) GAMETYPE_WIDTH 10
							$evalfloat(SERVERNAME_WIDTH+MAPNAME_WIDTH+PLAYERS_WIDTH+GAMETYPE_WIDTH) PING_WIDTH 4
							$evalfloat(SERVERNAME_WIDTH+MAPNAME_WIDTH+PLAYERS_WIDTH+GAMETYPE_WIDTH+PING_WIDTH) 84 5
							$evalfloat(SERVERNAME_WIDTH+MAPNAME_WIDTH+PLAYERS_WIDTH+GAMETYPE_WIDTH+PING_WIDTH+84) 12 1
		visible			1

		doubleClick {
			/*close playonline ;*/
			uiScript JoinServer
		}

		onEnter {
			uiScript JoinServer
		}
	}

	// Status bar

// Misc Buttons
	BUTTON( 12, 102+316-20, .25*((SUBWINDOW_WIDTH)-30), 14, _("MSGID_MENU_PLAY_REFRESH_LIST"), .24, 11, uiScript RefreshServers )
	BUTTON( 6+6+(.25*((SUBWINDOW_WIDTH)-30))+6, 102+316-20, .25*((SUBWINDOW_WIDTH)-30), 14, _("MSGID_MENU_PLAY_CONNECT_TO_IP"), .24, 11, clearFocus ; open playonline_connecttoip )
	BUTTON( 6+6+(.25*((SUBWINDOW_WIDTH)-30))+6+(.25*((SUBWINDOW_WIDTH)-30))+6, 102+316-20, .25*((SUBWINDOW_WIDTH)-30), 14, _("MSGID_MENU_PLAY_SERVER_INFO"), .24, 11, clearFocus ; open playonline_serverinfo )
	BUTTON( 6+6+(.25*((SUBWINDOW_WIDTH)-30))+6+(.25*((SUBWINDOW_WIDTH)-30))+6+(.25*((SUBWINDOW_WIDTH)-30))+6, 102+316-20, .25*((SUBWINDOW_WIDTH)-30), 14, _("MSGID_MENU_PLAY_DELETE_FAVS"), .24, 11, clearFocus ; open playonline_deletefavs )

// Buttons //
	BUTTON( 6, WINDOW_HEIGHT-24, .5*(WINDOW_WIDTH-18), 18, _("MSGID_MENU_BACK"), .3, 14, uiScript ServerSort 2 ; close playonline ; open main )
	BUTTON( 6+.5*(WINDOW_WIDTH-18)+6, WINDOW_HEIGHT-24, .5*(WINDOW_WIDTH-18), 18, _("MSGID_MENU_PLAY_JOIN_SERVER"), .3, 14, uiScript JoinServer )
}
