My question involves bankruptcy in the state of: CA

I am so scared and I have no clue what to do. I am hoping you guys can help me out. I am going through a foreclouser on a 1st ($270,000) and 2nd ($80,000) and I am not sure what will happen and if I can file bankrupcy for help. Will I be responsible for the entire amount or just the 2nd. What chapter would be best for me. I make around $40,000 per year and have a car payment, my dad died so my mom lives with me now, and I have a child with no finacial help. My credit card debt is about $8,000. I am not wanting to get away from my obligations for free, I am just scared and dont want to end up on the streets.