How to delay a function (how to use WaitForSeconds() and yield)

I know this has been asked before, but it just doesn't work, and I don't see what I'm dooing wrong.

(I use javascript)

function Quit (score:int) //quits to main menu (scene)
{
    if (currentLevel>0) scores[currentLevel-1] = Mathf.Max(scores[currentLevel-1],score);
    currentLevel=0;
    //Application.LoadLevel(currentLevel);
    LoadCurrentLevel();
}

function LoadCurrentLevel() //is een coroutine (blijkbaar automatisch ofzo doordat er yield instaat ?
{
    yield WaitForSeconds (2);
    Application.LoadLevel(currentLevel);
}

I've read the documentation and I thought this would work, but it seems to wait for ever (instead of 2 seconds), Application.LoadLevel(currentLevel) is never executed.

don't know if it could be relevant, but this code is not part of a script attached to a gameobject (and it's a singleton).

EDIT:

I tried it differently now, like this:

function LoadCurrentLevel(wait:boolean) 
    {
        //if (wait) yield WaitForSeconds (2.5);
        //Application.LoadLevel(currentLevel);
        if (wait) 
        {
            isWaiting=true;
            waitingStart=Time.time;
        }
        else    Application.LoadLevel(currentLevel);
    }

    function Update()
    {
        if (isWaiting)
        {
            if (Time.time>waitingStart+2.5)
            {
                isWaiting=false;
                Application.LoadLevel(currentLevel);
            }
        }
    }

But it still doesn't work, it does exactly the same. why is that ?

Your script is correct. You need to attach your script to a GameObject.

What I do is create an Empty GameObject for all my games, and call it 'GameManager'.

Any game-wide scripts are then attached to that game object.