require "StandardMouseButton"
require "CDialog"
		
-- reserve constructor
CAS_ConfirmSkipDialog = 
{
	name = "CAS_ConfirmSkipDialog"
}

function CAS_ConfirmSkipDialog:Create(  )
	
	-- The main screen container
	local instance = root.dialogs[ self.name ];
	instance:SetPosition( 139, 99 )
	CDialog:Attach( instance )
	
	-- The ok button
	local okButton = instance.button
	
	local cancelButton = instance.cancelButton
	
	function instance:OnUpdate( )
		self:OnUpdateDialog()
	end
	
	
	-- The main init function
	function instance:Init( )
	
		--if ( instance.boardType == 0 ) then --apartment
		--	instance._foo:SetText("Are you sure you want to obtain the item list without solving the puzzle?");
		--elseif ( instance.boardType == 1 ) then	--escape
		--	instance._foo:SetText("Are you sure you want to use the Panic button? You'll escape this location, but you'll lose three minutes off the clock.");
		--end
		
		StandardMouseButton( okButton );
		okButton:Init( )

		StandardMouseButton( cancelButton );
		cancelButton:Init( )
	end

	-- Handle keyboard input for the dialog
	function instance:CharDown( i_Key )
		log( "On Key Down" .. i_Key )
	end

	-- The ok button
	function okButton:Init( )
		function okButton:Pressed( )
			instance:ScreenEvent( "Skip CAS", "CAS_ConfirmSkipDialog" )
			instance:CloseAndSave( )
		end
		self:AddAsGlobalHandler()
		function okButton:OnKeyDown( i_Key )
			-- press ok on pressing return button
			if ( i_Key == 13 ) then
				okButton:Pressed()
			end
		end
	end
	
	function cancelButton:Init( )
		function cancelButton:Pressed( )
			instance:CloseAndSave(  )
		end
	end
end

CAS_ConfirmSkipDialog:Create( )
