One thing you might need to do is "sysctl net.ipv4.ip_forward=1" (in addition to the command lockpicker gave).
To get back to "Managed Mode" just change `ad-hoc' to `managed'.
If you are using the madwifi drivers with atheros chipsets, however (I assume you aren't), the iwconfig command will not work. You'll need to create a virtual interface in ad-hoc mode (`wlanconfig ath0 dev wifi0 wlanconfig ath create wlandev wifi0 wlanmode ad-hoc'). (change `ad-hoc' to `sta' for managed mode (sta means station)).
Anyway, if you are using madwifi (or prism) drivers already, I suggest that instead of ad-hoc you set up as master mode and become your own wireless access point. This will enable you to have a much better control of security (if you chose to use the many programs that take advantage of it).
Even if you decide you're going to buy something, I would suggest a cheap/plain atheros card over a proprietary access point. If you decide to go with an access point, I suggest a Linksys WRT54G, as you can (if you so chose) to run linux on it (the openwrt project).