This article will teach you plenty about managing magnesium.
Do-It-Yourself Magnesium Supplements for the Reef Aquarium
http://reefkeeping.com/issues/2006-07/rhf/index.php
Use this calculator to find out how much to use. Just dissolve some magnesium salts in fresh water and add slowly to a high flow area of the tank. Do not try to increase by more than 100ppm/day
Reef Chemisty Calculator
http://home.comcast.net/~jdieck1/chemcalc.html