Code:
PANEL* inventory_main =
{
  bmap = "main.png";
  pos_x = 90;     
  pos_y = 0;    
  button (90, 154, "medkit3.png", "medkit1.png", "medkit2.png", give_health, NULL, NULL); 
  button (90, 274, "medkit3.png", "medkit1.png", "medkit2.png", give_health2, NULL, NULL);
  button (670, 75, "quit_clicked.png", "quit_normal.png", "quit_hover.png", hide_inv, NULL, NULL);
  flags = OVERLAY;
  }

PANEL* show_menu =
{
  bmap = "menu.png";
  pos_x = 10;     
  pos_y = 500;    
  button (0, 0, "clicked_menu.png", "normal_menu.png", "hover_menu.png", show_menu2, NULL, NULL); 
  flags = OVERLAY | SHOW;
  }

function hide_inv()
{
  	if(inventory_main.flags & VISIBLE)
{
	pan_remove(inventory_main);	
}
}

  function show_menu2()
{
	set (inventory_main, SHOW);
}



inventory_main is the inventory panel
show_menu is the button that opens the inventory
hide_inv is the code I have to hide the inventory, doesnt work
show_menu2 is the code used to make the button open the inventory.