
--------------------------------------------------------------------------------
class 'COriginalStoryPage'

function COriginalStoryPage:__init(screen)
	assert(screen);

	local zOffset = 50;
	local moviePosition = {1024.0/2.0 + 65.0, 768.0/2.0};
	local PREVIEW_SCALE = 1.0;
	local saveButtonPosition = {1024.0/2.0 + 65.0, 725};

	self.pageRoot = screen:CreateAnimation('data/Texture/Scenes/Common/area.png');
	self.pageRoot:SetColor('0x10FFFFFF');
	self.pageRoot:SetPosZ(zOffset);

	local back = screen:CreateAnimation('data/Texture/GUI/Extras/PageOriginalStory/pageBackground.jpg');
    back:AttachTo(self.pageRoot);
	back:SetHotSpot(800.0/2.0, 600.0/2.0);
	back:SetXY(moviePosition[1], moviePosition[2]); 
	back:SetPosZ(zOffset);

   	do    
   	    local button = MakeButton(saveButtonPosition[1], saveButtonPosition[2], 201, 88);
		button:DisableIfHidden(true);
   	    button:GetCaption():SetFont(BUTTONS_FONT);
   		button:GetCaption():SetScale(0.8);
   		button:SetZ(302.0);
    	
   		button:AttachTo(self.pageRoot);
   		button:SetAction('OnSaveStory');
   		button:SetSpriteUp('SaveStoryButton');
   		button:SetSpriteOver('SaveStoryButtonOver');
   		button:SetSpriteDown('SaveStoryButtonDown');
   		button:SetActionSound('Menu_button_click');
   	end

originalStoryPage = self;
end

function COriginalStoryPage:Show()
	self.pageRoot:Show();
end
function COriginalStoryPage:Hide()
	self.pageRoot:Hide();
end

-- Event handlers ------------------------------------------------------------
function OnSaveStory()
	assert(originalStoryPage);

	local sourceName = 	 	'data/Texture/GUI/Extras/PageOriginalStory/The Murders in the Rue Morgue.doc';
	local destinationName = 'The Murders in the Rue Morgue.doc';

	ShowResourceSavingConfirmationScreen('EXTRACONTENT_ORIGINAL_STORY_SAVE_TEXT', 
										 sourceName,
										 destinationName);
end