Homoclinic Bifurcation and Endogenous Cycles in the Dynamic IS-LM Model