How to open and close a door using logic blocks

Hi all,
Can anyone help with what I guess is a simple problem that I can’t figure out. In my game I want to be able to open a door by clicking on a button, then close the door by clicking again on the same button. So if the door is closed and the button is clicked it opens, and if the door is open and the button is clicked it closes.
How would I set up the logic blocks? I’ve managed to get the door to open by linking the left nouse button sensor to an ipo which opens the door. Where should I go from here?
Thanks for any help.

Rob

Use a ping-pong IPO actuator, and that will do it automatically.

I posted a file that should help you out
http://www.mediafire.com/?bzwzdotxxwd

Brilliant! Thank you!