Open your case and find out how many sata cables are coming out from the motherboard. I'm assuming you have 2, one for hdd and one for optical drive. This problem may be just a bad cmos battery not holding its settings and replacing may work. Also make sure all power and data cables are tight as this could be cause by vibration.
Any store that carries batteries should have it. Definately any electronic stores like best buy, radio shack. Even your local compute repair shop should have them.