Thermostat works sometimes, other times I have to shake the switch to get the air conditioner working. Is this a problem with the thermostat or the central air system? Thermostat is about 15 years old, air conditioner the same age.
Since the AC is kicking on, the problem isn't there. Thermostat is just a simple signalling circuit. Since you have to shake seems to suggest something is wrong with the thermostat.
Some of the old thermostats have a glass bulb with a bead of mercury mounted on the end of a bi-metal string. As the metals expand, the bulb will tilt allowing the mercury to slide down and complete a connection at the base of the bulb to signal AC to kick on. By shaking the thermostat your probably causing to mercury to make contact.
I think these mercury switches were probably used on system older than 15 years. Your thermostat could be just a simple bi-metal spring with contacts make a connection to another set of contacts on a slider. Again shaking will also cause the spring wobble and bend enough to make the necessary contact.
Anyways, problem is likely with that bi-metal spring. Since you have been shaking the thermostat the bi-metal string has either dislodged or way out of calibration. There might not even by any tension on the spring anymore. Has anyone recently bumped or knocked it off the wall at some point in the past?
I think your best bet is to replace the whole thermostat with a newer digital one. You should be able to find one at any of the big box hardware stores.