|MadSci Network: Astronomy|
In principle, this is a "simple" problem to solve. The orbit of the Earth about the Sun is an ellipse (with the center of mass between the Earth and Sun at one focus) and the orbit of the Moon is also an ellipse about the Earth (with the center of mass between Earth and Moon at one focus). In the simplest case these orbits are closed and lie in a plane. The Moon's orbit is inclined to the Earth's orbit about the Sun by about 5°. This introduces some difficulty into the equations once a coordinate system is set. Also, since you want to know when they will be in a given configuration we need to introduce a parameter of time. This is done using Newton's laws of motion. In the end the equations get much more complicated. Of course, the real solar system has more complications due to gravitational interactions between planets and tidal forces between Earth, Moon, and Sun. So there are more messy details to be added, but they are small effects over short periods of time.
There are many fine planetarium programs that make these calculations for you. Several of them also allow you to view the entire solar system in 3-D. Here is a list of programs from the Students for the Exploration and Developments of Space (SEDS): http://www.seds.org/billa/astrosoftware.html
If you would like the gory details of the calculations I'd be happy to talk you through them in email.
Try the links in the MadSci Library for more information on Astronomy.