require "scripts/style.lua"
local hireFunction;

reDoWindow = function()
	redisplayWindow("selecting");
end;

SetSelectingValues();
		
if(curQuality >= 4) then
	hireFunction = function()
		EnableWindow("hireWindow", false)
		DisplayDialog({"scripts/ok.lua", body="maxquality", title="maxquality_title", x = kCenter, y = kCenter});
		EnableWindow("hireWindow", true)
	end;
elseif	GetHiringPriceSelecting(curQuality+1) > availableMoney then
	hireFunction = function()
		EnableWindow("hireWindow", false)
		DisplayDialog({"scripts/ok.lua", body="nomoneyhire", title="nomoney_title", x = kCenter, y = kCenter});
		EnableWindow("hireWindow", true)
	end;
else
	hireFunction = function()
		EnableWindow("hireWindow", false);
		hired = DisplayDialog({"scripts/hireselecting.lua"});
		if(hired == 1) then
			CloseWindow();
		else
			EnableWindow("hireWindow", true);
		end
	end;	
end;

function getTutorial()
	return not AlreadyPlayedMinigame(2);
end;

if (getTutorialMode) then
	playingTutorial = getTutorial()
end;

DisplayDialog{
	"scripts/proceed.lua",
	start=function()
			PlaySelecting();
	   end,
    hire=hireFunction,
    title = "proceedtoselect_title",
	body = "proceedtoselect_body",
	name = "hireWindow",
	tutorial = playingTutorial
};
