The exact cause of cramps is not well understood, but there are some risk factors that are thought to contribute to this condition:
1) Muscle fatigue,
2) Heavy exercising,
4) Over weight
5) Electrolyte imbalances,
6) Vitamin deficiency,
The medical causes related to the disease process are;
1) Calcium and phosphorus imbalances can cause cramping.
2) Low potassium or sodium (salt) levels.
3) Deficiencies of a nutrient called hesperidin, an antioxidant flavonoid found in oranges and other citrus fruits, have also been linked to nocturnal leg cramps.
4) Overexertion, standing on concrete for long periods, or prolonged sitting (especially with the legs contorted) may contribute to nighttime cramps.
5) Having structural disorders in the legs or feet (such as flat feet) may increase the risk for cramps.
6) Among the many medical causes of muscle cramping include hypothyroidism, Addison's disease, uremia, hypoglycemia, anemia, and certain medications.
Electrolyte imbalances is generally considered the most common main cause (your's are normal, you mentioned). Some researchers believe inadequate stretching and muscle fatigue leads to abnormalities in mechanisms that control muscle contraction. Other factors may also be involved, including exercising or working in intense heat and dehydration.
Prevention of the cramps is the best cure; for that following measures should be employed:
1) Drink water at regular intervals, even whey you are not thirsty.
2) Drink more than what you require.
3) Drink fruit juice or a sports beverage if the working conditions are hot and one sweats a lot.
4) If cramps occur frequently, stretching exercises help. Muscle relaxant like chlorzoxazone can also help.
5) Following exercise may help you before you go to bed; Stand about 30 inches from a wall and, keeping the heels flat on the floor, lean forward and slowly move the hands up the wall to achieve a comfortable stretch.
6) A few minutes on a stationary bicycle at bedtime may also help.
7) While in bed, loose covers should be used to prevent the toes and feet from pointing, which causes calf muscles to contract and cramp easily.
8) Propping up the feet up than the rest of the body may also help.
9) During the week, swimming and water exercises are a good way to keep muscles stretched, and wearing supportive footwear is also important.
10) Eating more nuts, seeds, seafood and low-fat dairy would help.
You can consult your physician who would review your medications and medical history. Also, take Calcium and vitamin D with a supplement of magnesium and zinc a day. Gatorade, can help as it contain electrolytes. Once a cramp starts, do the following measures so it is arrested immediately;
1) Straighten the leg, flex the foot upward toward the knee, or grab the toes and pull them toward the knee.
2) Walking or shaking the affected leg, then elevating it, may also help.
Please feel free for your follow up questions.