A Theory of the Cooperative Jahn-Teller Effect –Crystal Distortions in Cu1-xNixCr2O4 and Fe1-xNixCr2O4–