Reset the SMC, as per > Resetting the System Management Controller
1. Shut down the computer.
2. Unplug the computer's power cord.
3. Wait fifteen seconds.
4. Attach the computer's power cord.
5. Wait five seconds, then press the power button to turn on the computer.
and test it.
Still acting funny, reset the NVRAM, as per > About NVRAM and PRAM
1. Shut down the computer.
2. Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
3. Turn on the computer.
4. Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
5. Hold the keys down until the computer restarts and you hear the startup sound for the second time.
6. Release the keys.
and again test it.
Still having trouble, startup in Safe Mode > OS X: What is Safe Boot, Safe Mode?
1. Be sure your Mac is shut down.
2. Press the power button.
3. Immediately after you hear the startup tone, hold the Shift key.
The Shift key should be held as soon as possible after the startup tone, but not before the tone.
4. Release the Shift key when you see the gray Apple logo and the progress indicator (looks like a spinning gear).
startup normally and test it.
Now then, if all of the above did not solve the problem. Contact your local Apple Store or AASP and make a service appointment, using > Apple - Find Locations