This used to happen to me in my 02 when I would disconnect my battery to reset to factory defaults for the tranny (see 45+ page thread pinned at top of this forum). Scared the crap out of me the first time, but then knew it was to happen anytime I disconnected the battery.
The ECU is learning the MAF sensors, TB position sensor, etc, etc. It will clear out in a few hours (definately less than a day). I would drive around on all kinds of roads, just remembering to have to give it some gas at the stop lights so I wouldn't stall. Often I would through it in N, so I could give it a little gas. Don't worry, from experience, it clears out and will be idling normally in a short period of time.
steviej