require( "scripts/style.lua" );

local playername = gEnterNameValue;

local deleteselected = false;

MakeDialog
{
	Bitmap
	{
		image="backgrounds/profiles/new/back",
		x=kCenter,
		y=kCenter-50,

		
		Text
		{
			name = "entername",
			font = {  "fonts/lithos.mvec",  34,  Color(88,76,46,255)},
			x=3,y=25,w=500,h=40,
			flags = kHAlignCenter + kVAlignTop,
			label = "enternameprompt"
		},

		TextEdit
		{
			font = { "fonts/lithos.mvec",  30,  Color(88,76,46,255)},
			flags = kHAlignCenter,
			name = "nameedit",
			label = playername,
			clearinitial = deleteselected,
			x=96,y=173,w=360,h=kMax,
			length=11,
			ignore = kIllegalNameChars
		};
	

		Button
		{
			x=49, 	y=325,
			name="enterok",
			type = kPush,
			graphics = {"backgrounds/profiles/new/b_ok",	"backgrounds/profiles/new/b_ok_pressed",	"backgrounds/profiles/new/b_ok_mouseover"},
			command =
				function()
				    PlayGSound("butt");
				    sss = GetLabel("nameedit");
					if (IsNameInUse(sss, true)) then
						SetNameInfosToRun("infodupname");
						DoModal("scripts/infos.lua");
					else
						CloseWindow(GetLabel("nameedit"));
					end
				end
		},

		Button
		{
			x=391, y=325,
			name="entercancel",
			graphics = {"backgrounds/profiles/new/b_cancel",	"backgrounds/profiles/new/b_cancel_pressed",	"backgrounds/profiles/new/b_cancel_mouseover"},
			type = kPush,
			command =
				function()
					CloseWindow(nil);
				end
		};
	},

}

SetFocus( "nameedit" );


