Foreclosure or a deed in lieu of foreclosure (if you're more than 30 days late on your mortgage) will generally strike a 200 to 300 point toll against your FICO score. The actual amount depends a lot on your scrore before the issue. The worse off your score was before, the bigger hit it will take now. And it stays on your record for 10 years. You'll have to wait about 24 to 72 months before you may be able to qualify for a new mortgage at a rate you might want to swallow.
Short sales generally (if you're more than 60 days late on your mortgage) is basically the same impact on your credit score as foreclosure, although it shows up under a slightly different heading. A short sale may enable you to get a decent mortgage again in a little less time than a foreclosure though. FNMA guidelines, for example, require only 24 months (compared to 5 years for a foreclosure) as long as you kept your payments current and had no payments of 60 days of more late. But rememeber with short sales to make sure the lender will no be going after you for the deficiency - get a release before you agree to sell.
And don't forget the possible tax implications.
From the lender view, they don't care how the loss is taken, the bottom line is they have incurred a loss.
From the FICO scoring view, serious delinquency, derogatory public record and collection filed all fall under "score factor code #22"