Pause Menu open/close with one key

Hello,
I got a little problem here. I know why the code doesnt work, but i dont know how to get around this problem. I want to use the same button to open and to close my pause menu (escape). The problem is that when i set the first var (MenuOpen = true) my second if statement is true and it closes the menu again. How can i fix that.

The debug.logs where just there to test stuff out.

Here is the code:

var OpenMenu : boolean = false;

function Update() {

	if (Input.GetKeyDown ("escape") && OpenMenu == false){
		OpenMenu = true;
		Debug.Log("Menu Open");
		}
	if (Input.GetKeyDown ("escape") && OpenMenu == true) {
	OpenMenu = false;
	Screen.showCursor = false;
	Screen.lockCursor = true;
	Debug.Log("Menu Closed");
		}	
		
}


function OnGUI () {
	if (OpenMenu == true){
	GUI.Box (Rect (Screen.width/2-125,Screen.height/2-200,250,300), "Pause Menu");
	Screen.showCursor = true;
	Screen.lockCursor = false;
	Time.timeScale = 0;
	Debug.Log("I got here");
	
	
	
}
}

if (Input.GetKeyDown (“escape”)){

if(!openmenu)

{
Debug.Log(“Menu Open”);
openmenu =true;

}
ELSE if(openmenu)
//close menu;

}
all you need is an else

You can use if … else:

if (Input.GetKeyDown(KeyCode.Escape))
{
    if (!OpenMenu)
    {
        Debug.Log("Menu Open");
    }
    else
    {
        Screen.showCursor = false;
        Screen.lockCursor = true;
        Debug.Log("Menu Closed");
    }
    OpenMenu = !OpenMenu;
}

var OpenMenu : boolean = false;

function Update() {
    if (Input.GetKeyDown ("escape")){
        if (OpenMenu){
            OpenMenu = false;
            Screen.showCursor = false;
            Screen.lockCursor = true;
            Debug.Log("Menu Closed");
        }else{
            OpenMenu = true;
            Screen.showCursor = true;
            Screen.lockCursor = false;
            Time.timeScale = 0;
            Debug.Log("Menu Opened");
        }
    }
}
function OnGUI () {
    if (OpenMenu == true){
        GUI.Box (Rect (Screen.width/2-125,Screen.height/2-200,250,300), "Pause Menu");
        Debug.Log("I got here");
    }
}

Note that you should never use the OnGUI() method to do logic since it is a drawing method that can be called more frequently then the Update() method (Source).