Congrats on the home purchase!
On a primary personal residence (i.e. not a second home or investment/rental property), capital gains taxes do not apply unless you have over $250,000 of gain ($500,000 if married and filing jointly) regardless of what you use the proceeds for. So, it does not matter when you purchase your new home as long as the gains on your old house are less than $250,000 (Selling Price - Purchase Price + Basis Adjustments). Basis adjustments are things like rennovations - things beyond normal repairs and maintenance. If you gains are greater than $250,000 you have to pay capital gains regardless of what the proceeds are used for.
The 2 year rule that David is speaking of was changed in the late 1990's to the above.
Again, the above applys only to primary personal residences. If you're selling an investment property or second home, let me know and I'll explain those rules since they are different.
Here's an article that explains it pretty well: http://www.bankrate.com/finance/real...-owners-1.aspx
Disclaimer - The above is for educational purposes only and is not to be construed as tax advice. Contact a CPA or tax attorney licensed in your state prior to making any determinations regarding federal or state taxes owed.