Dimension of local rings on scheme of finite type over a field. In chapter III Hartshorne seems to be using without proof or mention a theorem on the dimensions of local rings of schemes of finite type over a field.  I know that for an integral scheme of finite type over a field the dimension of the local ring at a closed point is equal to the dimension of the scheme.  I am guessing the following theorem is the correct generalization:

Let $X$ be a scheme of finite type over a field $k$ and let $x\in X$.  Then $$\dim \mathcal{O}_x+\dim \{x\}^-=\sup_{x\in V \text{ irreducible component}} \dim V$$
where the sup on the right is taken over all irreducible components of $X$ containing $x$.

I think it should be possible to reduce to the affine case.  Once I reduce to the affine case the problem basically reduces to showing that for a finitely generated $k$-algebra $A$ and a prime ideal $\mathfrak{p}$ of $A$, that $$\dim A_\mathfrak{p}+\dim A/\mathfrak{p}=\sup_{\mathfrak{p}\supset\mathfrak{q} \text{ height } 0}\dim A/\mathfrak{q}$$
where the sup on the right is taken over all prime ideals $\mathfrak{q}$ of height $0$ contained in $\mathfrak{p}$.
It is a theorem cited in Hartshorne that this algebraic result holds when $A$ is integral, in which case the right hand side is just $\dim A$.  Can anyone confirm that the desired result is true and that my general approach works (i.e. that my "facts" are actually facts)?  I'm going a little crazy trying to get all the details in place.
EDIT: I posted a full solution.  I think it's correct, but let me know if you disagree.
 A: I'm going to only handle the integral case. A chain of prime ideals in $A/p$ is the same thing as a chain of prime ideals in $A$ starting at $p$, and a chain of prime ideals in $A_{p}$ is the same as a chain of prime ideals contained in $p$. But we can put these two together, to get a chain going through $p$. Now, every affine domain is catenary (see Kemper, Theorem 8.22) so could take that chain to be maximal and we are done.
A: I finally got the details straight.  Here is a proof:
Reduction to affine case:
Let $U$ be an open subset of $X$.  We claim that the irreducible components of $U$ are just the intersections with the irreducible components of $X$ which meet $U$, and that their dimensions are preserved upon intersection.  Take $V$ an irreducible component of $X$ which meets $U$.  Showing $V\cap U$ is irreducible is just some basic point set topology.  For the statement about dimension, point set topology shows $V\cap U$ has dimension less than or equal to $V$, but we can't get equality without using some scheme theory.  To get equality, we use the fact that open subsets of an integral scheme of finite type over a field all have equal dimension.  We give $V$ the reduced induced structure, making it a closed integral subscheme of $X$, hence also of finite type over $k$.  Then $V\cap U$, which is open in $V$, must have the same dimension as $V$.  This also gives that the closure of $x$ in $X$ has the same dimension as the closure of $x$ in $U$, since $\{x\}^-\cap U$ is the closure of $x$ in $U$, and $\{x\}^-$ is irreducible.  
Now let $x\in X$ be any point and take an open affine set $U$ containing $x$.  By the affine case and the preceding, we have $$\dim \mathcal{O}_x + \dim \{x\}^- =\sup_{x\in V \text{ irreducible component}} \dim V$$ since we have just shown that both sides of the equation are invariant under intersecting with $U$, which reduces to the affine statement.  
Affine case:
Let $X=\text{Spec }A$ where $A$ is a finitely generated algebra over $k$ and let $x\in X$ correspond to the prime ideal $\mathfrak{p}$.  We wish to show $$\dim A_\mathfrak{p}+\dim A/\mathfrak{p}=\sup_{\mathfrak{p}\supset\mathfrak{q} \text{ height } 0}\dim A/\mathfrak{q}$$
It is easy to see that the left hand side is less than or equal to the right hand side since any maximal chain containing $\mathfrak{p}$ begins with a minimal prime ideal contained in $\mathfrak{p}$.  
The reverse inequality will follow from the following: we claim that given a prime ideal $\mathfrak{q}$ of $A$, the lengths of all maximal chains beginning with $\mathfrak{q}$ are equal.  This follows from the affine case of Exercise II 3.20 in Hartshorne, which was mentioned in the first paragraph of my question, by considering $A/\mathfrak{q}$ which is integral.  
Now to prove the reverse inequality, choose $\mathfrak{q}$ to be a minimal prime ideal contained in $\mathfrak{p}$ which maximizes the right side of our desired equation.  Consider the chain $\mathfrak{q}\subset \mathfrak{p}$ (if $\mathfrak{q}=\mathfrak{p}$ the proof is easy so assume otherwise).  Extend this chain to a maximal chain (possible since maximal chains have finite length), which necessarily has length equal to the number on the right side of our desired equation by the above claim.  This establishes the reverse inequality and completes the proof.
