Chapter 7 bankruptcy will delay foreclosure for about 3 to 4 months. A chapter 7 bankruptcy imposes an automatic stay on your creditors, including the mortgage company, whereby they are prevented from continuing any act to collect on a debt, including foreclosing on your home or rental real estate. However, if you are significantly behind the bank can and will file a motion for relief from the automatic stay, asking the court to lift your protections so that they can continue with the foreclosure. These can be fought, but doing so is usually difficult. The net bottom line is that a chapter 7 can buy you a number of months to get caught up with mortgage payments on a home that you are hoping to keep.
A chapter 13 bankruptcy can delay foreclosure indefinitely and provide a means to force the bank to accept make up payments over time. It can also be used to get rid of second mortgages in some cases. Whereas outside of bankruptcy the lender may become difficult about accepting late payments and make unreasonable demands about catching up, inside a chapter 13 bankruptcy you can propose a reasonable repayment schedule and interest rate, and force the lender to accept that plan.
If you hope to use bankruptcy to avoid a foreclosure on your home, you must get your case filed before the sale date set by the public trustees office in your Colorado county. The more time your lawyer has to prepare your case, the better. I have filed cases just before the deadline and faxed bankruptcy notices to the public trustee, but I would much rather plan the case and have time to get it done correctly with a minimum of stress. It is also of course more difficult to come up with legal fees for you bankruptcy if the matter has not been discussed and planned for in advance.