Order of integration problem in probability

In a problem in my probability course we change the order of integration, and I am having trouble seeing why we can do it this way.

$$\int_0^\infty \int_{\{x : g(x) > t\}} f_X(x)dxdt = \int_{-\infty}^\infty \int_{\{t : 0 \le t < g(x)\}} f_X(x) dt dx.$$

Can anyone enlighten me to why this works. I know how it works with simple examples, but for some reason the $g(x) > t$ is messing with my head.

-
Consider $0 \leq t < g(x) < \infty$. Where did you get stuck? – Alex Nov 29 '12 at 0:14

This is a simple application of indicator functions technique and Fubini's theorem \begin{align} \int\limits_0^\infty \int\limits_{\{x : g(x) > t\}} f_X(x)dxdt &= \int\limits_0^\infty \int\limits_{-\infty}^\infty f_X(x) 1_{\{(x,t) : g(x) > t\}}dxdt \\ &=\int\limits_{-\infty}^\infty \int\limits_0^\infty f_X(x) 1_{\{(x,t) : g(x) > t\}}dtdx \\ &=\int\limits_{-\infty}^\infty \int\limits_0^\infty f_X(x) 1_{\{(x,t) : g(x) > t\geq 0\}}dtdx \\&=\int\limits_{-\infty}^\infty \int\limits_{\{t : 0\leq t < g(x)\geq 0\}} f_X(x) dtdx \end{align}
Let $I(x,t)$ be a function of $x$ and $t$ which is $1$ when $g(x) \gt t$ [i.e. when $t \lt g(x)$] and is $0$ otherwise.
So you have $$\int_{t=0}^\infty \int_{x=-\infty}^\infty f_X(x)I(x,t) \,dx\, dt = \int_{x=-\infty}^\infty \int_{t=0}^\infty f_X(x)I(x,t) \,dt \,dx$$ and which should be intuitively obvious: $f_X(x)I(x,t)$ is a non-negative function of $x$ and $t$ so it does not matter which order you do the integration over the whole half-plane.