tournamentNotEnoughPoints_options = {lng_TOURNNOTENPOINTSRETRY, lng_TOURNNOTENPOINTSMENU}
tournamentNotEnoughPoints_numOptions = 2

function tournamentNotEnoughPoints_onSubmitPressed()
	cfunction("enableInput", 0)
	closeAndDestroyPopupWindow("tournamentNotEnoughPoints_afterPopupDestroy", PopupOptions["FADETOLOADING"])
	cfunction("showFontOverlay", "menu_content", 0,100,30,100)
end

function tournamentNotEnoughPoints_afterPopupDestroy()
	if tournamentNotEnoughPoints_curSel == 1 then
		cfunction("exitScriptSystem", UIReturnCodes["TOURNAMENT_RESTART"])
	else
		cfunction("exitScriptSystem", UIReturnCodes["TOURNAMENT_EXIT"])
	end
end

function tournamentNotEnoughPoints_onEnterState()		
	tournamentNotEnoughPoints_curSel = 1
	cfunction("enableInput", 0)
	openPopupWindow("tournamentNotEnoughPoints_showContentAfterOpening", 2.0, 0)
end

function tournamentNotEnoughPoints_showContentAfterOpening()
	cfunction("enableInput", 1)
	cfunction("showFontOverlay", "menu_content", 1,100,0,90)
	tournamentNotEnoughPoints_setSelectionCursor()

end

function tournamentNotEnoughPoints_onLeaveState()	
	cfunction("showFontOverlay", "resultFont", 0,0,0,65)	
end


function tournamentNotEnoughPoints_onDownPressed()
	if tournamentNotEnoughPoints_curSel == 1 then 
		tournamentNotEnoughPoints_curSel = 2
	else
		tournamentNotEnoughPoints_curSel = 1
	end
	tournamentNotEnoughPoints_setSelectionCursor()
end

function tournamentNotEnoughPoints_onUpPressed()
	if tournamentNotEnoughPoints_curSel == 1 then 
		tournamentNotEnoughPoints_curSel = 2
	else
		tournamentNotEnoughPoints_curSel = 1
	end
	tournamentNotEnoughPoints_setSelectionCursor()
end

function tournamentNotEnoughPoints_setSelectionCursor()
	xText = '\05'..lng_TOURNNOTENPOINTSMSG.."\n\n"
	for i = 1, tournamentNotEnoughPoints_numOptions do
		xText = xText .. '\05'
		if tournamentNotEnoughPoints_curSel == i then
			xText = xText .. "@  "
		end
		xText = xText .. tournamentNotEnoughPoints_options[i]
		if tournamentNotEnoughPoints_curSel == i then
			xText = xText .. "  @"
		end
		xText = xText .. "\n"
	end
	cfunction("setFontOverlayText", "menu_content", xText)
end
