Asteroid 99942 aka Apophis [1] is on an orbit about the sun that takes it close to the earth twice in 7 years. It will pass the earth at a distance of about 37000 km on 13. April 2029 (closer than some earth satellites). Depending on the exact trajectory during this passage, earth's gravitational pull may set it up for an impact in 2036. Apophis is about 300 m in diameter, so an impact at about 12.6 km/s would be a major disaster rivaling the Krakatoa explosion of 1883. Apophis will hit the earth in 2036 only if it passes through a roughly 600-meter [2] wide region in space close to the earth on 2029/4/13. A deflection manouver to make it miss the keyhole would be much easier than one to make it miss the entire earth. Up to about 2026, a velocity change of 1 micron per second [2] is sufficient to deflect Apophis from a trajectory that would go through the center of the keyhole to one that makes it miss. After passage through the keyhole (which is not at all certain, yet), a deflection will need to change the velocity by up to about 1 cm/s.

The planetary society has initiated a competition for ideas to track the orbit of Apophis accurately enough to know whether or not Apophis will pass through the keyhole in 2029. This information should be available by 2017, so that a deflection mission can be planned and executed by 2026. This would leave 3 years for a velocity change to result in an accumulation of positional deviation, and missing the keyhole. Most likely the tracking mission will involve placement of a radio beacon or optical reflector.
I have developed a proposal for such a tracking mission. It is rather innovative, and its realization would require a lot of R&D, so it didn't win a prize. The original text (available upon request) is dated August 31, 2007. This version, dated December 27, 2010 is identical to the original text save for 2 modifications: My address is removed and one typo is corrected.
The proposal focuses mostly on the radio science and technology for the beacon, but part of the effort was also to calculate an optimal transfer trajectory for the spacecraft carrying the beacon to fly from Earth to Apophis. For this, I wrote a little program to scan all transfer trajectories with given departure and arrival times and locations (Earth for departure and Apophis for arrival). For lack of time, and given the emphasis on the radio-science aspect, the program was a kludge, and could do only planar geometries (i.e., ignoring the orbital inclinations). It is listed here, together with a brief documentation.
Meanwhile, I have re-written the program with several improvements, The new version can do three-dimensional calculations, and is written with future upgrades in mind, such as optimization with one or more mid-course rocket burns. I will make this program available under the Gnu Public License (GPL), meaning anyone is free to use and modify it under the condition that the modified version (or the original) is also made available under the GPL. An early version of the program is listed here. It is written in perl (as was the old program), but at some point I will convert it to C++.

[1] NASA, Near Earth Object Program
[2] R. Schweickart, C. Chapman, D. Durda, P. Hut, B. Bottke, D. Nesvorny, Threat Characterization: Trajectory Dynamics, wpdynamics.pdf