Potassium is important for maintaining the pathway between nerve synapses. It also builds muscle tissue. Bananas are a good source of potassium; so are lima beans, tomatoes, potato skins, leafy greens, nuts, fish (esp. salmon), and even chocolate.
You can also take a daily multi-vitamin (like Centrum), which also contains enough calcium. Actually, half of one is really enough, and don't take the ones marketed to women and osteoporosis because they have waaaay more calcium than you need.
Don't want to overdo it; too much potassium can seriously affect your heart rate, while too much calcium makes it easier for kidney stones to form. I'd rather have the leg cramp, I think.
Smoking also increases your chances of having cramps because of its effects on the blood vessels.