We give a family of weighted inversion numbers with the same generating function which interpolate between the inversion number and MacMahon's major index. Foata's bijection is obtained in a natural way from a simple involution. An alternative proof uses q-difference equations which yield some new results. We obtain a new generating function for restricted growth functions and two q-analogs of a formula for the number of standard Young tableaux of a given shape. While the first really goes back to MacMahon, the second uses one of our weighted inversion numbers and appears to be new.