Help making an animated door (c#)

I am making a game that, when you click a door, the door opens. When you click again, the door closes.

But i could only make the door open. When i click again, it goes back to the ground and goes up again. I wanted it to close (or play the animation by reverse) :confused:

Help?

BTW here is the code im using:

using UnityEngine;
using System.Collections;

public class OpenDoorClick : MonoBehaviour {
	
void OnMouseDown()
{

gameObject.animation.wrapMode = WrapMode.Once;
gameObject.animation.Play();
}
	
}

there are a couple ways at this link
link text

simplest is to make another animation of the door closing, and play it:

bool doorOpened = false;

void OnMouseDown()
{

   gameObject.animation.wrapMode = WrapMode.Once;

   if(!doorOpened){
      animation.Play("open");
      doorOpened = true;
   }else{
      animation.Play("close");
      doorOpened = false;
   }
 
}