It's called a dual circuit or switched socket. You want a headphone jack socket with 5 external pins. One is common for ground, two are L/R audio input, and two are L/R audio output (to speakers).
When you insert the headphone jack the internal pins move, disconnecting from the speaker pins and connecting to the headphones instead.
See diagram D here:
This, I think, is what you need (although the page doesn't actually state it and there's no data sheet, so proceed with caution)
http://uk.rs-online.com/web/p/jack-trs-connectors/5130421/