relay, 2 way powered dc motor

I'm trying to figure out how to control a 5V DC motor using a 2 way switching device such that it is powered by the arduino for a certain period of time and then switched to being run by a battery. Any ideas or circuit construction designs are appreciated. Thanks.

you need 2 relais put the common on the motor, and the no to + and the nc to -