A past bankruptcy or foreclosure does not permanently close the door on homeownership. Here are the waiting periods by loan type and what to do during that time.