Quality factors and effective-average modal gain or loss in inhomogeneous spherical resonators: application to two-photon absorption