Same button to open and close gui texture

var inventory : boolean;

function Start (){
inventory = false;
}

function OnGUI(){
    var bag =GameObject.FindWithTag("bag");
    crossTexture = bag.GetComponent (GUITexture);

    GUI.Box(Rect(100,100,300,100),"Inventory");
    if(GUI.Button(Rect (100,150,100,25),"Open"))
    {
    crossTexture.enabled=true;
    }
    if(GUI.Button(Rect (150,200,100,25),"Close"))
    {
    crossTexture.enabled=false;
    }
}

how can I rewrite the script where i just use only one button to open and close the texture?

Just set the texture to the opposite of its current state:

if(GUI.Button(Rect (100,150,100,25),"Open/Close"))
{
     crossTexture.enabled = !crossTexture.enabled;
}