There is normally a waiting period that you must wait for prior to buying a new home. I hear there is a new program that allows you after one year to purchase again. However, I haven't run across a client that has taken advantage of it as of yet. I do know that after three years you should be fine.
I am not sure what you mean by 'waiting for a foreclosure to finish out'. if you mean that your home is being foreclosed on, you would have to wait 3 years to qualify for a mortgage under the current rules. A short sale can take 3-4 months at best and possibly even longer.