Carefully examine your financial targets before you pull the bankruptcy trigger. While bankruptcy often takes care of immediate debts (and usually stops foreclosure), it has long-term consequences. It may fix present problems, but create problems for your future in terms of your credit score. Bankruptcy tends to limit more severely your ability to get a loan for a house, a car, or an education.
To learn more about the basics of bankruptcy, the US Courts has a collection of short films online for free to give you general information at http://www.uscourts.gov/multimedia/videos.aspx. Talk to your attorney about the specifics of your situation to help you decide if bankruptcy is right for you.