local resourceFileNameToSave = nil;
local destinationFileNameToSave = nil;

--------------------------------------------------------------------------------
function ShowResourceSavingConfirmationScreen(textAlias, resourceFileName, destinationFileName)
	resourceFileNameToSave = resourceFileName;
	destinationFileNameToSave = destinationFileName;

	local screenZOffset = 300;
    local confirmationScreen = BuildYesNoScreen(textAlias,
                                          		'NotesSavingConfirmed',
                                          		'NotesSavingDiscarded');
	confirmationScreen:SetLayer(POPUP_WINDOWS_LAYER + screenZOffset);
	confirmationScreen.textBox:SetBorderSize(550.0 / confirmationScreen.textBox:GetScale(), 0);
	confirmationScreen.textBox:SetY(confirmationScreen.textBox:GetY() - 60.0);
	do
		local bg = confirmationScreen:CreateAnimation('data/Texture/Scenes/Common/fade.png');
		bg:SetHotSpot(512.0/2.0, 384.0/2.0);
		bg:SetPosXY(512, 384);
		bg:SetPosZ(-1);
		bg:SetScale(2.0);
		bg:SetOpacity(0.75);
	end

    PopUpScreensMgr:Push(confirmationScreen, false);
end

-- Event handlers ------------------------------------------------------------
function NotesSavingConfirmed()
	assert(resourceFileNameToSave and destinationFileNameToSave);
	local sourceType = type(resourceFileNameToSave);

	if (sourceType == 'string') then
		SaveResourceIntoMyDocumetsFolder(resourceFileNameToSave, destinationFileNameToSave);

	elseif (sourceType == 'table') then
		assert(table.getn(resourceFileNameToSave) == table.getn(resourceFileNameToSave));

		for resourceIndex,resourceItem in pairs(resourceFileNameToSave) do
			SaveResourceIntoMyDocumetsFolder(resourceItem, destinationFileNameToSave[resourceIndex]);
		end

	else
		assert(Log('NotesSavingConfirmed() : Unacceptible type of source parameter !') and false);
    end
	NotesSavingDiscarded();
end

function NotesSavingDiscarded()
	resourceFileNameToSave = nil;
	destinationFileNameToSave = nil;

	PopCurrentPopUpScreen();
end
