from wikipedia (http://en.wikipedia.org/wiki/Cramp) --
Nocturnal Leg Cramps
Nocturnal leg cramps are involuntary muscle contractions that occur in the calves, soles of the feet, or other muscles in the body during the night or (less commonly) while resting. The duration of nocturnal leg cramps is highly variable with cramps sometimes only lasting a few seconds and other times several minutes. Soreness in the muscles may remain for some time after the cramp ends. These cramps are more common in older people but may happen to anyone. They can happen quite frequently in teenagers and in some people while they are exercising at night. Nocturnal leg cramps can be very painful especially if the person is dehydrated.
The precise cause of these cramps is unclear. Potential contributing factors are believed to include low levels of certain minerals (magnesium, potassium, calcium and sodium); dehydration; and prolonged sitting. Less common causes include more serious conditions or use of drugs.
Nocturnal leg cramps may be relieved by stretching the affected leg straight out and pointing the toes upward. People report that quickly standing up and walking a few steps may also shorten the duration of a cramp.