A damage mechanics model for power-law creep and earthquake aftershock and foreshock sequences