ipsec between 2 offices and internet through a single server

Good time of day!

We have 2 offices, and RB951G in each of them. The real ip addresses are in both offices. There is one server in main office, with NAT, giving the internet for the clients of main office. Each office has its own LAN. The goal is to create an IPSEC tunnel between offices, and the clients in branch office must go to internet throught the server in the main office. We do not want to use any proxy server in main office, need direct traffic from a branch office to server in main office and than to the internet. Please advice, where I can see the configuration examples like my case?

Check the presentation in my sig, ask if you have any questions.