-- +==========================================+
-- |LibTimer                                  |
-- |Made by Setras, edited a bit by cristimirt|
-- |Last update: 10-07-2013                   | 
-- +==========================================+

local TimerFunction

function timer(params)
if params.wtOwner:IsEqual( mainForm ) then
	TimerFunction()
	StopTimer()
end
end

 function StopTimer()
    common.UnRegisterEventHandler( timer, "EVENT_EFFECT_FINISHED" )
end

function StartTimer(f,n)          ----call this function, with n = time to wait in ms and f the function to be called after n ms passed
	TimerFunction = f
    common.RegisterEventHandler( timer , "EVENT_EFFECT_FINISHED", {effectType = ET_FADE, wtOwner = mainForm} )
    mainForm:PlayFadeEffect( 1.0, 1.0, n, EA_MONOTONOUS_INCREASE )
end