Dan, an REI Outdoor School instructor, demonstrates how to properly position your body while mountain biking up and down hills in this video. You want to lean forward while going up a hill and lean back while going down a hill. This balance will give you the most stability.
http://www.rei.com/bikeyourdrive