Approximately 400,000 individuals undergo heart operations each year and cognitive impairment occurs frequently following surgery. An increasing number of these individuals are elderly and are particularly susceptible to cognitive dysfunction following surgery. Cognitive impairment is most notable in the early stages following heart surgery, but it may persist in some individuals. While many people think cognitive impairment is subtle, transient, or subclinical, perioperative decline is associated with 5-year cognitive deterioration and reduced quality of life. Multiple strategies, both clinical and pharmacological, have been proposed to reduce the central nervous system dysfunction associated with heart surgery. However, most strategies have been unsuccessful, met with limited success, or are unrealistic from a cost or risk-benefit ratio for the majority of people. This study will examine the effectiveness of supplemental magnesium at preventing the cognitive decline associated with heart surgery.