All-optical femtosecond switch using two-photon absorption