

--function arcadeAgainQuestion_onDownPressed()

arcadeAgainQuestion_options = {lng_RACEAGAINYES, lng_RACEAGAINNO}
arcadeAgainQuestion_numOptions = 2


function arcadeAgainQuestion_onDownPressed()
	if arcadeAgainQuestion_alreadyPressed == 0  then
		arcadeAgainQuestion_curSel = arcadeAgainQuestion_curSel +1
		if arcadeAgainQuestion_curSel ==3 then 
			arcadeAgainQuestion_curSel =1
		end
		arcadeAgainQuestion_setSelectionCursor()
	end
end

function arcadeAgainQuestion_onUpPressed()
	if arcadeAgainQuestion_alreadyPressed == 0  then
		arcadeAgainQuestion_curSel = arcadeAgainQuestion_curSel -1
		if arcadeAgainQuestion_curSel ==0 then 
			arcadeAgainQuestion_curSel = 2
		end
		arcadeAgainQuestion_setSelectionCursor()
	end		
end

function arcadeAgainQuestion_reloadData()
end

function arcadeAgainQuestion_afterWait()
	if arcadeAgainQuestion_curSel == 1 then
		cfunction("exitScriptSystem", UIReturnCodes["ARCADE_RESTART"])
	elseif arcadeAgainQuestion_curSel == 2 then
		cfunction("exitScriptSystem", UIReturnCodes["ARCADE_EXIT"])	
	end
end

function arcadeAgainQuestion_afterPopupDestroy()	
	--cfunction("showBitmapOverlay", "generalLoading", 1,100,176,120)	
	cfunction("setTimer", 200, "arcadeAgainQuestion_afterWait")
end
	
function arcadeAgainQuestion_onSubmitPressed()
	if arcadeAgainQuestion_alreadyPressed == 0  then
		reg_1 = arcadeAgainQuestion_curSel
		arcadeAgainQuestion_alreadyPressed = 1
		cfunction("callCPPFunction", "fadeSound", "0", 0)
		cfunction("showFontOverlay", "menu_content", 0, 100, 0, 100)
		cfunction("enableInput", 0)
		
		closeAndDestroyPopupWindow("arcadeAgainQuestion_afterPopupDestroy", PopupOptions["FADETOLOADING"])		
	end
end


function arcadeAgainQuestion_setSelectionCursor()

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

function arcadeAgainQuestion_onLeaveState()	
end

function arcadeAgainQuestion_onEnterState()	
	cfunction("enableInput", 0)
	arcadeAgainQuestion_curSel = 1
	arcadeAgainQuestion_alreadyPressed = 0	
	openPopupWindow("arcadeAgainQuestion_showContentAfterOpening", 0.8)	
end

function arcadeAgainQuestion_showContentAfterOpening()
	--cfunction("showBitmapOverlay", "EndOfGameOptions", 1, 100, 240-32, 136-16)	
	cfunction("showFontOverlay", "menu_content", 1, 100, 0, 135)
	arcadeAgainQuestion_setSelectionCursor()
	cfunction("enableInput", 1)
end

