Image: Couple and cash © Digital Vision Ltd., SuperStock

You've figured out your goals. You know what they'll cost. So you've put all of your money into your investment portfolio.

Then you lose your job. Where will you get money for food, rent, your phone?

You don't want to dip into that investment portfolio. After all, you've built it with a particular goal and time frame in mind. Touch it now and risk making your future dreams unattainable.

That's why it's important to set aside money in an emergency fund before you begin investing. Here are some pointers for what your emergency fund should cover, how long it should last and where to put it.

What to include

Don't assume that any future unemployment insurance payments can take the place of an emergency fund. Think of collecting unemployment as a way to strengthen the safety net you're constructing. It shouldn't be your sole support. And if you do collect unemployment, your emergency fund simply will last longer.

We recommend that you cover all conceivable expenses in your emergency fund.

Food and shelter: How much do you spend on groceries each month? If you don't know, now is a good time to start tracking that. And if you eat out a lot, you'll either need to include that, or plan on higher grocery bills. If you have pets, include the cost of their food and care in the tab.

Unless you're ready to move into your brother-in-law's basement, be sure to cover your rent or mortgage payments, too. And don't forget utilities -- gas, electric, water, phone, cable and Internet.

Transportation: Unless you plan on never leaving your house, set money aside for your car payments and public transportation. Of course, you'll also need money for filling up your car, for routine maintenance and more serious problems.

Insurance and health: Be prepared to meet your insurance payments. That means home, auto, life and, especially, health insurance.

Insurance premiums are often the first things to go when money gets tight. They shouldn't be. One of the quickest roads to penury is to let your health insurance lapse and to find yourself with a serious health condition.

Set aside money for routine dental and eye care, prescriptions and any other health expenses your insurance doesn't cover. Once again, if you have pets, put their vet bills on the tab.

Taxes: Uncle Sam won't care that you're unemployed -- you'll still have to pay income and property taxes. Here's some consolation, though: Your emergency fund also protects you from additional taxes. After all, your tax bill could be much stiffer if you had to sell profitable investments to cover your living expenses.

Finding a new job: It can cost money to make money -- finding a new job won't be free. Consider the cost of producing and sending out resumes. You might want to meet with a career consultant or take some kind of training. Take those possibilities into account.

How to estimate what you'll need

That's a long list to compile and come up with hard numbers for. The good news is that you don't have to try to brainstorm every conceivable expense.

Instead, track what you spend in the next few months and use that as your baseline. Then add in any other possible expenses, such as taxes or finding a job, that didn't pop up during those months.

If you spent money on movies or your health-club membership, include that. If you're out of work, taking in an occasional flick and working out may help relieve some of your stress.

How long should it last?

Most financial planners recommend setting aside six months' worth of living expenses in an emergency fund.

What if your "emergency" ends up lasting longer than six months? If you take the liberal view of living expenses that we've been taking so far, your emergency kitty likely will last a little longer. Further, we haven't included payments from unemployment insurance. If you do collect unemployment, your emergency fund should last longer, too.

Of course, you may not be able to pull all of your emergency-fund money together at once. Treat it as a goal. Maybe you can cover one or two months' expenses now. Add to that kitty over time. If you get a tax refund, put it in your emergency fund. A bonus at work? Sock at least part of that away.

But in general, don't invest elsewhere until you have a full emergency fund. (The exception to this may be your 401k plan. If your employer offers matching funds, you should strongly consider contributing at least enough to maximize your company's match. Otherwise, you are leaving money on the table with every paycheck.)

Where to put the emergency fund

Keep your emergency fund separate from your regular bank account. That way, you may feel less of an urge to tap into it in normal times. But thanks to automatic teller machines and online transfers, you'll have easy access to the money if you do need it.

A money-market fund is a great place for your emergency dollars. Money-market mutual funds invest in super-short-term, high-quality debt and are among the most conservative funds available. Their prices (or net asset values) don't move around much. In fact, because they invest in bonds issued by extremely stable debtors, such as the U.S. government and large, financially sound companies, money-market funds can maintain a steady $1 net asset value, making them ideal for investors who don't want to risk their principal.

Money-market funds also offer several features designed to help investors manage their cash reserves. Most offer limited check-writing privileges. It doesn't take much to start out, either. Many money-market funds have low minimum investment requirements.

Why not just stick with a bank? Money-market funds often pay as much as a percentage point more than banks' money-market accounts do. You'd get even less interest than that if you stashed your cash away in a checking or savings account.

There's a minor catch: Unlike consumer bank accounts, money-market funds are not FDIC insured. That means that the government won't step in if something goes haywire and your money-market fund loses money.

However, that danger is minimal. Money-market funds are regulated by the Securities and Exchange Commission, which enforces strict limits on the types of investments that these funds can make. Thus, it is unusual for a money-market fund to "break the buck," or fall below its $1 net asset value.

Unusual -- but not unheard of. For instance, during the credit crisis of 2007, reports indicated that some money market managers were holding stakes in problematic securities, including so-called SIVs (structured investment vehicles), which took a hit amid the market turmoil. But even in cases such as these, the funds' parent companies typically step in to support the funds, and no investors lose money.

Investors can take the safer route by choosing a money-market fund that invests exclusively in the direct obligations of the U.S. government. The drawback is that these funds typically pay out less income than those investing in corporate debt, too.

Choosing a money-market fund doesn't have to be hard.

Click here to become a fan of MSN Money on Facebook

  • Go bargain-hunting. There's little that a money-market fund manager can do to improve yield and returns, so low-expense funds have an edge.
  • Find a package that works for you. Check-writing privileges and minimum investment requirements vary from fund to fund.
  • Start close to home. If you have a brokerage account, check out the associated money-market funds. But don't assume that the money fund that your money automatically gets swept into is the best deal. It's worth shopping around within your account's options.
  • Check out iMoneyNet's money fund site. It has tons of information on yields and more hints for choosing a money-market fund.