A short sale will affect your credit for 3 years, while a foreclosure or deed in lieu will affect your credit for 5-7 years.
I have seen some individuals who had VERY high credit ratings before a short sale (in the 700"s) buy again the same year, but for most it takes about 3 years. Start working NOW with a HUD counselor (You can find them at Beyond Housing, Better Family Life or NECAC) to do the necessary repairs to your credit and get you in a position to buy. If any special programs come up that might help you to buy sooner, they will know about them as well.
Good Luck, Dale