The way you implement this is 100% up to the menu system you use. If you use the standard templates, you are going to be using static links that are built ONCE (during the page rendering), and are not going to be "smart". If you use a javascript menu system like this site:
http://www.menscience.com/ (top tabs)
Then you can have that effect. In essence this is not a shopping cart feature but more of a menu feature, there are many dhtml menus that allow you to keep the last selection selected based on what was clicked or the URL currently being browsed, if this is a must, and you don't want to have multiple static templates, then i suggest you look for a menu system in DHTML or FLASH that will do this for you.