Toggle animations - if 2 are activated - open door

I am trying to play a door opening animation when two levers are pressed up. Right now it will only play the down pressed animation (lever1down lever2down) when I hit “Fire 1” and never the up animation. I have added both of the animations to each gameobject and they are both set to legacy. Can you let me know what I am doing wrong? I am new to writing code like this…

var lever1 : GameObject;
var lever2 : GameObject;
var elevator1 : GameObject;
private var lever1Pos = false;
private var lever2Pos = false;

function Update () {
   if (Input.GetButtonDown ("Fire1"))  // if left button pressed...
     { 
		var ray : Ray = camera.ViewportPointToRay (Vector3(0.5,0.5,0));
		// Do a raycast
		var hit : RaycastHit;
		if (Physics.Raycast (ray, hit))
			{
				if (hit.transform.name == "Lever1" && lever1Pos == false)
				{
					lever1.GetComponent.<Animation>().Play("Lever1up");
					lever1Pos = true;
				}
				if (hit.transform.name == "Lever1" && lever1Pos == true)
				{
					lever1.GetComponent.<Animation>().Play("Lever1down");
					lever1Pos = false;
				}
				if (hit.transform.name == "Lever2" && lever2Pos == false)
				{
					lever2.GetComponent.<Animation>().Play("Lever2up");
					lever2Pos = true;
				}
				if (hit.transform.name == "Lever2" && lever2Pos == true)
				{
					lever2.GetComponent.<Animation>().Play("Lever2down");
					lever2Pos = false;
				}
			}
	}

	if (lever1Pos && lever2Pos)
	{
	elevator1.GetComponent.<Animation>().Play("Elevator1");
	}
}

Check if the animations work, for this, just change the name of the animation of the code that’s working. If everything ok, try no to define variables private var lever1Pos = false; private var lever2Pos = false; at the beginning. Try instead doing this

if(GetCompnent(whatever).enabled=true)
{
  GetCompnent(whatever).enabled = false;
}
else
{
  GetCompnent(whatever).enabled = true;
}