Assuming the problem started after the battery was replaced it sounds like it may have lost the idle adaptive. I would start with cleaning the throttle body. Usually they get coked up around the area where the throttle blade is at closed throttle. You can use a soft bristle brush and some spray carb cleaner. You will have to hold the throttle open while cleaning. DO NOT use a wire brush, a cheap toothbrush works well. After that take it out and drive it getting it up to 45 MPH then slowing down at least 3 times. If that doesn't do it you could have a problem with anything from the IAC to the PCM and considering the expense of guessing wrong you might be better off to have a professional diagnose it for you.