The foreclosure transaction itself - reportable on 1099-A - http://www.irs.gov/pub/irs-pdf/f1099a.pdf should be treated as disposition of the property at the sale price.
The capital gain/loss is calculated as (selling price) - (basis - that is mainly purchase price with some adjustments)
The loss on personal property is not deductible. The gain is taxable, but if the property was used as a primary residence at least two out of five years - you may exclude the gain from taxable income (up to $250,000 for singles)
If you negotiate with the creditor and all or part of the debt is forgiven or the debt would be canceled under bankruptcy protection procedure - you are sent the form 1099-C.
California law provides that in case of foreclosure or short sale of the primary home - homeowners may not be held liable for deficiency - that is a luxury of living in California.
However - your credit report will be damaged. See more details and examples in this article - http://www.gibsonlawcaliforniarealestate.com/deficiencies-when-is-a-debt-still-owing-after-foreclosure.html
The amount of debt forgiven is reportable on 1099-C - http://www.irs.gov/pub/irs-pdf/f1099c.pdf - generally is taxable, unless an insolvency exemption apply -- you should file a form 982 - to proof your insolvency - and might exclude all or part of canceled debt from taxable income.
The Mortgage Forgiveness Debt Relief Act of 2007 allows exclusion of income realized as a result of modification of the terms of the mortgage, or foreclosure on your principal residence. You still need to file the form 982 to claim the exclusion.
Let me know if you need any help.