require( "scripts/style.lua" );


local levelname;


MakeDialog
{
	Bitmap
	{
		image="backgrounds/entername",
		x=kCenter,
		y=kCenter,


		Bitmap
		{
			image="backgrounds/entername",
			x=kCenter,
			y=kCenter,

--			Text
--			{
--				name = "entername",
--				font = {  standardFont,  34,  WhiteColor},
--				x=3,y=25,w=500,h=40,
--				flags = kHAlignCenter + kVAlignTop,
--				label = "enterlevel"
--			},

			TextEdit
			{
				font = { standardFont,  30,  WhiteColor},
				flags = kHAlignCenter,
				name = "nameedit",
				label = levelname,
				x=kCenter,y= kCenter + 84, w=290,h=kMax,
--				x=113,y=110,w=290,h=kMax,
				length=28,
				--ignore = kIllegalNameChars

			};
		},

		Button
		{
			x=90, 	y=327,
			name="enterok",
			type = kPush,
			graphics = {"buttons/b_ok",	"buttons/b_ok_pressed",	"buttons/b_ok_mouseover"},
			command =
				function()
						nnnn = GetLabel("nameedit");
						nnnn = string.lower(nnnn);	
						if TestLocName(nnnn) then
							--AddLocInfoPassBefore(nnnn);
							SetNextLocName(GetLabel("nameedit"));
							CSWithSh("mainmenu", "scripts/maingame.lua",false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "1" then
							CSWithSh("mainmenu", "scripts/FingerprintWindow.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "21" then
                                                        SelectEnteredMGLevel(2);
							CSWithSh("mainmenu", "scripts/FingerprintWindow.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "2" then
							CSWithSh("mainmenu", "scripts/GamePuzzleWindow.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "22" then
                                                        SelectEnteredMGLevel(2);
							CSWithSh("mainmenu", "scripts/GamePuzzleWindow.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "3" then
							CSWithSh("mainmenu", "scripts/mg01window.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "23" then
                                                        SelectEnteredMGLevel(2);
							CSWithSh("mainmenu", "scripts/mg01window.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "4" then
							CSWithSh("mainmenu", "scripts/mg06window.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "24" then
                                                        SelectEnteredMGLevel(2);
							CSWithSh("mainmenu", "scripts/mg06window.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "5" then
							CSWithSh("mainmenu", "scripts/mg05window.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "25" then
                                                        SelectEnteredMGLevel(2);
							CSWithSh("mainmenu", "scripts/mg05window.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "6" then
							CSWithSh("mainmenu", "scripts/mg07window.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "26" then
                                                        SelectEnteredMGLevel(2);
							CSWithSh("mainmenu", "scripts/mg07window.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "7" then
							CSWithSh("mainmenu", "scripts/mg04window.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "27" then
                                                        SelectEnteredMGLevel(2);
							CSWithSh("mainmenu", "scripts/mg04window.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "8" then
							CSWithSh("mainmenu", "scripts/mg08window.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "28" then
                                                        SelectEnteredMGLevel(2);
							CSWithSh("mainmenu", "scripts/mg08window.lua", false);
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "99" then
							--CSWithSh("mainmenu", "scripts/splashstart.lua");
							--DoModal("scripts/shadow.lua");
							--CloseWindow(GetLabel("nameedit"));
							--gCurrMGameText = "MiniGame4Fin"
							--DoModal("scripts/infogamewin.lua")
							GoToComicsFin("scripts/mainmenu.lua", "scripts/mainmenu.lua","mainmenu", "lev5exit.xml"); 
							CloseWindow(GetLabel("nameedit"));
							
	
						elseif nnnn == "map" then
							CSWithSh("mainmenu", "scripts/map.lua");
							DoModal("scripts/shadow.lua");
							CloseWindow(GetLabel("nameedit"));
						elseif nnnn == "" then
							CloseWindow(nil);
						end;	
				end
		},

		Button
		{
			x=240, 	y=327,
			name="entercancel",
			graphics = {"buttons/b_cancel",	"buttons/b_cancel_pressed",	"buttons/b_cancel_mouseover"},
			type = kPush,
			command =
				function()
					CloseWindow(nil);
				end
		};
	},

}

SetFocus( "nameedit" );


