3 paths to take when facing foreclosure

What's the best way to avoid ruining my credit?