How to reduce to the affine case? $\phi(X)$ contains a nonempty open subset of $\overline{\phi(X)}$ Let $\phi: X \rightarrow Y$ be a morphism be varieties over an algebraically closed field.  I'm trying to prove that $\phi(X)$ contains a nonempty open subset of $\overline{\phi(X)}$.  I know how to solve the problem when $X$ and $Y$ are affine and irreducible with $\phi(X)$ dense in $Y$, and I'm trying to understand how we can reduce the problem to this case.  I am generally having trouble with problems like this, I don't understand how people can reduce to the affine case so quickly.
So far I have reduced to the case where $Y$ is affine, and I'm currently trying to understand how to reduce further.
By a variety, I mean a locally ringed space of $k$-valued functions with a finite open cover by open affines.  Here an affine variety is the maximal spectrum of a reduced finitely generated algebra over the (algebraically closed) field.
 A: To start, we can certainly assume that $\overline{\phi(X)}=Y$ (if this isn't true, just replace $Y$ by $\overline{\phi(X)}$).  Now let $C_1,\dots,C_n$ be the irreducible components of $Y$.  Then $U=Y\setminus (C_2\cup \dots\cup C_n)$ is a nonempty open subset of $Y$.  Furthermore, $U\subseteq C_1$ and hence $U$ is irreducible since it is an open subset of an irreducible variety.  Replacing $Y$ by $U$ and $X$ by $\phi^{-1}(U)$, we may assume $Y$ is irreducible (if $\phi(X)$ contains a nonempty open subset of $U$, then $\phi(X)$ contains a nonempty open subset of $Y$ since $U$ is open in $Y$).  Replacing $Y$ by a nonempty affine open subset of $Y$ and replacing $X$ by its inverse image, we may also assume $Y$ is affine.
Now let $D_1,\dots, D_m$ be the irreducible components of $X$.  The sets $\overline{\phi(D_i)}$ are closed sets whose union is $\overline{\phi(X)}=Y$, so by irreducibility of $Y$ one of them is all of $Y$.  Replacing $X$ by the corresponding component, we may assume $X$ is irreducible.  Now replace $X$ by a nonempty affine open subset (which is dense in $X$ and hence does not disturb the condition $\overline{\phi(X)}=Y$), and we've reduced to the case you know how to do.
