goalFillSuitcase.mSteps =
{
	{ action = "click", object = objectPorchLipstick, started = true },
	{ action = "click", object = objectPorchMakeupbrush, started = true },
	{ action = "click", object = objectPorchMirror, started = true },
	{ action = "click", object = objectPorchParfum, started = true },
	{ action = "click", object = objectPorchRaggedshirt, started = true },
	{ action = "click", object = objectPorchShoe, started = true },
	{ action = "click", object = objectPorchSkirt, started = true },
	{ action = "click", object = objectPorchSock, started = true },
	{ action = "click", object = objectPorchToothbrush, started = true },
	{ action = "click", object = objectPorchWallet, started = true },
	{ action = "click", object = objectPorchSuitcaseBackground, selection = objectStackoclothes },
	{ action = "click", object = objectPorchDoorOpen, state = kActive }, -- dummy click to force the poi to close	
}
goalFillSuitcase.readyToStart = false
goalFillSuitcase.clothesPlaced = false
goalFillSuitcase.clothesBusy = false
-- ----------------------------------------------------------------------------
function goalFillSuitcase:onStarted()
end
-- ----------------------------------------------------------------------------
function goalFillSuitcase:onFinished()

	objectPorchSuitcaseBackground:ss(kDone)
	objectPorchSuitcaseBrush:ss(kDone)
    objectPorchSuitcaseLipstick:ss(kDone)
    objectPorchSuitcaseMirror:ss(kDone)
    objectPorchSuitcaseParfume:ss(kDone)
    objectPorchSuitcaseRaggedshirt:ss(kDone)
    objectPorchSuitcaseShoe:ss(kDone)
    objectPorchSuitcaseSkirt:ss(kDone)
    objectPorchSuitcaseSock:ss(kDone)
    objectPorchSuitcaseToothbrush:ss(kDone)
    objectPorchSuitcaseWallet:ss(kDone)
    
    if (goalFindFuses:isActive()) then
		think("MESSAGE_PORCH_SUITCASE_READY")
	end
	
    objectPorchDoorOpen:ss(kActive)
    objectPorchShed:ss(kActive)	

end
-- ----------------------------------------------------------------------------
function goalFillSuitcase:onSolveFinish(layout)
	if (layout == layoutPorchSuitcase) then
		layoutPorchSuitcase:hide()
	end
end
-- ----------------------------------------------------------------------------
function goalFillSuitcase:onAnimationFinish(animationName)
	
	if (animationName == "animSwitchSuitcases_blocking") then
		objectPorchSuitcaseOpen:ss(kDone)
		
		self:achieved()
	elseif (animationName == "fadingInClothes_blocking") then
		self.clothesPlaced = true
		self.clothesBusy = false
		
		layoutPorchSuitcase:solve()
	end
	
end
-- ----------------------------------------------------------------------------
function goalFillSuitcase:onLayoutShow(layout)
	
	if (not self.readyToStart) then
		if (layout == layoutPorchSuitcase) then
			self.readyToStart = true
		end
	end
	
end
-- ----------------------------------------------------------------------------
function goalFillSuitcase:onLayoutHide(layout)
	
	assert(not self.clothesBusy)
	if ((layout == layoutPorchSuitcase) and (self.clothesPlaced == true)) then
	
		objectPorchSuitcaseClosed:setAlpha(0)
		objectPorchSuitcaseClosed:ss(kIdle)
		
		objectPorchSuitcaseOpen:animate("animSwitchSuitcases_blocking",
			{ delay=300									},
			{ alpha=1									},
			{ alpha=0,		duration=kTimeFadeSwitch	}
		)
		objectPorchSuitcaseClosed:animate(
			{ delay=300									},
			{ alpha=0									},
			{ alpha=1,		duration=kTimeFadeSwitch	}
		)
		
	end
	
end
-- ----------------------------------------------------------------------------
function goalFillSuitcase:onUsedAll(object, props)

	if (object == objectPorchSuitcaseBackground) then
		objectPorchSuitcaseBackground:ss(kIdle)
		self.clothesBusy = true
		
		-- First piece of clothing animated separately because we need the animation name:
		objectPorchSuitcaseBrush:setAlpha(0)
		objectPorchSuitcaseBrush:ss(kIdle)
		objectPorchSuitcaseBrush:animate("fadingInClothes_blocking",
			{ alpha=0								},
			{ alpha=1,		duration=kTimeFadeIn	}
		)

	    self:fadeClothingIn(objectPorchSuitcaseLipstick)
	    self:fadeClothingIn(objectPorchSuitcaseMirror)
	    self:fadeClothingIn(objectPorchSuitcaseParfume)
	    self:fadeClothingIn(objectPorchSuitcaseRaggedshirt)
	    self:fadeClothingIn(objectPorchSuitcaseShoe)
	    self:fadeClothingIn(objectPorchSuitcaseSkirt)
	    self:fadeClothingIn(objectPorchSuitcaseSock)
	    self:fadeClothingIn(objectPorchSuitcaseToothbrush)
	    self:fadeClothingIn(objectPorchSuitcaseWallet)
	    
	end

end
-- ----------------------------------------------------------------------------
function goalFillSuitcase:fadeClothingIn(object)

	object:setAlpha(0)
	object:ss(kIdle)
	object:animate(
		{ alpha=0								},
		{ alpha=1,		duration=kTimeFadeIn	}
	)

end
-- ----------------------------------------------------------------------------
function goalFillSuitcase:shouldStart()

	return self.readyToStart

end
-- ----------------------------------------------------------------------------
function goalFillSuitcase:onClickObject(layout, object, props, x, y)

	if (objectStackoclothes:isFound()) then
		objectPorchSuitcaseBackground:ss(kActive)
		think("MESSAGE_CLOTHES_COLLECTED")
	end
	
end