Lets say I have
This may be a bit convoluted and could certainly use optimization, but you could use a combination of things posted so far:
jsFiddle: http://jsfiddle.net/psyon001/Vcnvz/2/