--tournamentResult

function tournamentResult_onUpPressed()
	resultList_inputUp()
end

function tournamentResult_onDownPressed()
	resultList_inputDown()
end

function tournamentResult_onSubmitPressed()
	cfunction("enableInput", 0)	
	resultList_hide()
	--cfunction("fadeOverlay", "resultLevelName", 100,0,250)
	cfunction("fadeOverlay", "resultLevelRecord", 100,0,250)
	cfunction("setTimer", 250, "tournamentResult_afterTextFadeOut")
end

function tournamentResult_onLeaveState()	
end

function tournamentResult_onEnterState()		
	cfunction("enableInput", 0)
	createWindowFrame("tournamentResult_afterWindowOpen", 2.68, 15)	
end

function tournamentResult_afterWindowOpen() 
	cfunction("showFontOverlay", "resultLevelName", 1,100,0,17)
	cfunction("setFontOverlayText", "resultLevelName", "")
	cfunction("setFontOverlayText", "resultLevelName", '\05'.."@ "..tournamentData[flow_tournamentId]["name"] .."  "..lng_TOURNRESULTNAME.." @")
	
	cfunction("showFontOverlay", "tournamentStatus", 1,100,0,252)
	cfunction("setFontOverlayText", "tournamentStatus", '\05' .. string.format(lng_TOURNRESULTPOINTSREQ, flow_tournamentTrackInTournament,
																			tournamentData[flow_tournamentId]["numTracks"],
																			tournamentData[flow_tournamentId]["pointsNeeded"]))
	
	if tournamentResult_isNewRecord == 1 then
		cfunction("showFontOverlay", "resultLevelRecord", 1,100,0,35)
		cfunction("setFontOverlayText", "resultLevelRecord", '\03'..'3'..'\05' .. lng_TOURNRESULTNEWRECORD.." "..getReadableTime(tournamentResult_newRecordMin,tournamentResult_newRecordSec,tournamentResult_newRecordHSec)..'\03'..'0')
	end
	
	resultList_setNumberOfOpponents(flow_arcadeNumberOfOpponents)
	resultList_setPlayerIndex(flow_trackFinishedPosition)
	resultList_setHeader(tournamentResult_fontOverlayHeader)
	resultList_show()
	
	cfunction("enableInput", 1)
end

function tournamentResult_afterTextFadeOut()
	cfunction("transitionToState", "tournamentSumResult")
end