Hiding Inactive Menubar Items
There is a nice tutorial on the various options and techniques here: http://mac.tutsplus.com/tutorials/customization/customizing-the-os-x-menu-bar/

None of these is quite as flexible as you ask for (Wifi hides when wifi is off...), but realize that the majority of those icons are controls as well as indications. For example, if the wifi is off, the icon can be used to access the wifi controls. This can be real handy to turn the wifi back on. ;-) Hiding the icon would make that a more lengthy process, forcing you to go through the settings app.