There are two things that caused rattling in my engine compartment while idling.  First was the alternator pulley.  Second were the idler pulleys.  One way to tell if it's a pulley is to take the front engine cover off and use a mechanic's stethascope (sp?) to listen to each pulley and see if you can find the source of the noise.
Good luck! 
