help! engine problems for a newbie!

i just got a 2000 sonata, and the engine has a tendency to shut off while iím idling at a stoplight. the key will still be in the "on" position in the ignition, and the car will still be in drive, but the
engine is off. i have to put it in park, take the key out of the ignition, and then re-start the car. itís happened about four times now, and itís coupled with the "check engine" light coming on periodically, and then turning off again after a couple of days.
this is my first car, and iíve been confusing this with stalling, so iím a little confused about what i should think. thanks!
Posted using the interface, at author's request
Articles individually checked for conformance to usenet standards
  Click to see the full signature.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
Add image file
Upload is a website by car enthusiasts for car enthusiasts. It is not affiliated with any of the car or spare part manufacturers or car dealers discussed here. All logos and trade names are the property of their respective owners.