car wont start but lights and radio come on on 2005 Ford Focus

when the car has been sitting for a few hours it will not start. the lights and radio come on and the lights dont dim after trying to start the car. once it starts then i can start it again if i shut it off and let it sit for 30 minutes to an hour but if i let it sit for a few hours then it wont start again.

Asked by for the 2005 Ford Focus
2 answers
altenator or battery if u can get it started bring it advance auto parts or auto zone and have them test it them
The foucus won't start but everything elus works it wont even turn over