Dynamics of the magnetosphere during geomagnetic storms on January 21–22, 2005 and December 14–15, 2006