It's not something anyone wants to think about; but if there's a chance unemployment looms, be prepared.

The writing is on the wall. Or more to the point, the pink slip.

More than 230,000 Americans have lost their jobs so far this year, and the outlook isn't pretty. Maybe you work for a company that has announced cuts, and you expect to be among them. Or perhaps you're employed in a battered business, where it seems the axe could drop at any moment.

At times like this, stay focused on your work — but go on the offensive at home. Get a handle on monthly expenses, research savings-account and money-market yields in the event you're forced to sell stock, make medical appointments and fill prescriptions in case you no longer have employer-subsidized health coverage, and, not least, talk honestly with your family and, if you have one, your financial adviser.

"Have an exit strategy and expect the unexpected," says Carrie Schwab-Pomerantz, chief strategist of consumer education at Charles Schwab & Co.

There's no good way around it. If you see a layoff coming, you'll need to act quickly to sort your investments and other financial affairs to make sure there's cash when you need it.

Here are five steps to take:

1. Keep a spending log. You'll have to cut expenses if you lose your job. But before you start slashing, find out how much you've been spending, and on what.

"You want to say, 'Where is my money really going, and how am I making decisions?' " says Nathan Dungan, founder of Share Save Spend, an educational program that encourages healthy financial habits.

Map your spending over four weeks, Dungan suggests. Include every expense, no matter how small. Break down the costs into distinct categories. First, the basics: groceries, toiletries, clothing and transportation. Then, discretionary items: restaurants, entertainment, hobbies. Finally, include the cost of staying connected: cell phone, Internet, cable television, newspapers and magazines.

After a month, people are often surprised by what they've doled out the dollars for, and chagrined when they divide this list into "needs" and "wants." It's all too easy to take expenses for granted.

2. Establish credit lines. You don't want to borrow money when your job is in jeopardy; you just want the ability to borrow.

"I would apply for every dollar of credit I could get," says Kevin Ellman, a financial adviser at Wealth Preservation Solutions in Ridgewood, N.J. "The time to get credit is when you have a job. If you find yourself in a cash jam, you need to have that as a fallback, even if you don't tap it ... I'd rather have the credit and not need it, then need it and not have it."

A home equity line of credit is a must, advisers say, but is difficult to get if you don't have a job. This isn't a loan; it simply provides access to funds using your home as collateral. Once you're approved for this credit line, use it only as a lifeline.

"Don't borrow any money on it unless it's an emergency," says Sheryl Garrett, founder of the investment advisory service Garrett Planning Network.

And if you're using a home equity credit line already, don't be too eager to prepay it. With home values falling, lenders aren't as generous. A new credit line — based on a revised appraisal of your home — could give you less just when you need it most.

3. See a doctor. Your company's health-care plan has been subsidizing your medical costs. That will end with your job. Your spouse's company plan is an option, but it might cost more. Absent that, you can maintain insurance, typically for up to 18 months, through the government-mandated Cobra plan, but the premiums will be substantially higher than you've been paying.

Accordingly, take care of any pending medical needs while you're still covered on more favorable terms. "If you were thinking of having a checkup, filling prescriptions, getting new eyeglasses, this would be a good time," Ellman says.

4. Talk with your family and advisers. Dungan, the Share Save Spend founder, vividly remembers when he was in fifth grade and his father lost his job. It was, understandably, an anxious time, but his parents did what many families fail to do: They talked about it with their kids.

"They didn't want to blow it out of proportion," Dungan says. "But they said this is going to happen and we need to make some adjustments. They explained matter-of-factly what was going on ... and solicited our ideas about how we could be frugal."

Talk with your spouse and parents about the possibility you might lose your job. Include your children in discussions. That's especially true for teenagers, but even younger kids can look at a list of household spending and family income and discuss places to cut and odd-jobs they can do.

"You're almost doing a disservice to your family without talking with them and showing responsibility," Schwab-Pomerantz says. "If you talk to them sooner, they feel a part of the process and they're more likely to support the situation rather than resent it."

Financial advisers also can be strong allies. "The best advisers earn their keep in terms of preventing their clients from acting strictly on emotion," says Christine Benz, director of personal finance at investment researcher Morningstar Inc. "You have to be honest and tell them what's going on. That way they'll be in a better position to address your situation."

5. Create an emergency fund. Now that you know what you spend, decide how much to save. The general rule is to keep at least three to six months' of after-tax income — more if you can — in an emergency fund that's parked in a straightforward, interest-bearing bank account, short-term CD or money-market account.

"An emergency fund buys you time and minimizes stress," Dungan says. "It gives you freedom and flexibility. You could hold out for a better job, a job you're wanting, versus having to grab the first thing just to pay the bills."

One way to build cash reserves is to reduce or even eliminate contributions to 401(k) or other retirement accounts and deposit that money in the bank. If instead you tap the 401(k) — which you almost never should do — that money is taxed as ordinary income and penalized as a premature withdrawal.

What about trimming exposure to the stock market and its frequent gut-wrenching swings? Good idea, says Ellman, the New Jersey financial adviser.

"The general strategy would be to lower your overall portfolio risk," he says. Move assets into high-quality bonds or bond funds; municipal bonds, for example, offer attractive tax-free yields right now. You could also book some investment losses, Ellman adds, to offset gains and reduce your tax bill.

Cutting expenses is the most obvious way to raise cash. That's where your spending log comes in handy. Premium cable channels, dining out, designer clothes, home improvements, a new car and other elective items can be among the first things to go.

"Budgeting is normally a dirty word," Ellman says. "But if you're in danger of losing your job, it's something you have to consider."