Dynamics of Bose-Einstein Condensates in Josephson Junctions