I would not recommend bankruptcy as long as there are other solutions available. There are a lot of people who cannot afford to pay thier mortgage on primary residence, and they decide on a short sale (it would affect the credit less dramatically, and the credit will recover faster). Loan modification could possibly be another solution, but as you say you are going in foreclosure it might be too late.
Hire an agent experienced in short sales. Success rate of short sales is pretty high right now, if everything is done right and you get an offer to submit with your short sale package within a short period of time, you can avoid foreclosure. In the meantime, you can google "short sale" and see what other sellers say about them.
Do not get discouraged. All the best!