tournamentProceedQuestion_options = {lng_TOURNPROCEEDQESTCONTINUE, lng_TOURNPROCEEDQESTRESTART, lng_TOURNPROCEEDQESTMENU}
tournamentProceedQuestion_numOptions = 3


function tournamentProceedQuestion_onDownPressed()
	if tournamentProceedQuestion_alreadyPressed == 0  then
		tournamentProceedQuestion_curSel = tournamentProceedQuestion_curSel +1
		if tournamentProceedQuestion_curSel ==4 then 
			tournamentProceedQuestion_curSel =1
		end
		tournamentProceedQuestion_setSelectionCursor()
	end
end

function tournamentProceedQuestion_onUpPressed()
	if tournamentProceedQuestion_alreadyPressed == 0  then
		tournamentProceedQuestion_curSel = tournamentProceedQuestion_curSel -1
		if tournamentProceedQuestion_curSel ==0 then 
			tournamentProceedQuestion_curSel = 3
		end
		tournamentProceedQuestion_setSelectionCursor()
	end		
end

function tournamentProceedQuestion_reloadData()
end

function tournamentProceedQuestion_afterWait()
	if tournamentProceedQuestion_curSel == 1 then
		cfunction("exitScriptSystem", UIReturnCodes["TOURNAMENT_NEXTTRACK"])
	elseif tournamentProceedQuestion_curSel == 2 then
		cfunction("exitScriptSystem", UIReturnCodes["TOURNAMENT_RESTART"])
	elseif tournamentProceedQuestion_curSel == 3 then
		cfunction("exitScriptSystem", UIReturnCodes["TOURNAMENT_EXIT"])
	end
end

function tournamentProceedQuestion_afterPopupDestroy()
	--cfunction("debugPrintF", "questionResult", tournamentProceedQuestion_curSel)		
	--cfunction("showBitmapOverlay", "generalLoading", 1,100,176,120)	
	cfunction("setTimer", 200, "tournamentProceedQuestion_afterWait")
end
	
function tournamentProceedQuestion_onSubmitPressed()
	if tournamentProceedQuestion_alreadyPressed == 0  then
		reg_1 = tournamentProceedQuestion_curSel
		cfunction("enableInput", 0)
		tournamentProceedQuestion_alreadyPressed = 1
		cfunction("callCPPFunction", "fadeSound", "0", 0)
		cfunction("showFontOverlay", "menu_content", 0, 100, 0, 100)
		
		closeAndDestroyPopupWindow("tournamentProceedQuestion_afterPopupDestroy", PopupOptions["FADETOLOADING"])		
	end
end


function tournamentProceedQuestion_setSelectionCursor()

	xText = ""
	for i = 1, tournamentProceedQuestion_numOptions do
		xText = xText .. '\05'
		if tournamentProceedQuestion_curSel == i then
			xText = xText .. "@  "
		end
		xText = xText .. tournamentProceedQuestion_options[i]
		if tournamentProceedQuestion_curSel == i then
			xText = xText .. "  @"
		end
		xText = xText .. "\n"
	end
	cfunction("setFontOverlayText", "menu_content", xText)
			
end

function tournamentProceedQuestion_onLeaveState()	
end

function tournamentProceedQuestion_onEnterState()
	--cfunction("debugPrintF", "tournamentProceedQuestion_onEnterState", 0)
	cfunction("enableInput", 0)
	tournamentProceedQuestion_curSel = 1
	tournamentProceedQuestion_alreadyPressed = 0	
	openPopupWindow("tournamentProceedQuestion_showContentAfterOpening", 1.0)	
end

function tournamentProceedQuestion_showContentAfterOpening()
	--cfunction("showBitmapOverlay", "EndOfGameOptions", 1, 100, 240-32, 136-16)	
	cfunction("showFontOverlay", "menu_content", 1, 100, 0, 130)
	cfunction("enableInput", 1)
	tournamentProceedQuestion_setSelectionCursor()
end




