Calibrating Accelerometer Values

Original Question Solved “Making Camera “Face Forward” despite a Phone’s Orientation.”

I basically want the camera to always face-up whenever a player rotates their phone. [See figure below]
I’m going for a top-down camera, and I want to steer a character using the accelerometer, but it will be a bit confusing to steer the camera if the player has to look from the side. What is the best way I can pull this off?

New Question:
Now, I want to be able to “Normalize” the accelerometer values so that whatever y is initially, will be adjusted to ‘0’, this way, if the person who is playing isn’t leveled, he won’t start the game off uneven.

alt text

Do like Tilt to Live. Have a calibration screen, ask the user to hold the device in what he considers the neutral position. Then base your calculations off that.