Dislocations in a layered elastic medium with applications to fault detection