How early can scientists detect that a deadly asteroid will hit planet earth? With the advancements in science and technology, how early can scientists of the world detect that a certain asteroid will hit planet earth and cause damage? Are there any impact avoidance strategies or a disaster recovery plan agreed upon by world nations?
Edit: This wikipedia article shows some links to few past projects
 A: The world's leader in the detection is NASA's Near-Earth Object Program

http://neo.jpl.nasa.gov/ 

which observes the objects and calculates their future locations. The Palermo scale and the Torino scale are being used to quantify the degree of the threat. Currently, there are just two objects that have a nonzero Palermo scale (namely the level 1, the minimal one after zero) and could hit in the 2040s and 2050s, see the table

http://neo.jpl.nasa.gov/risk/

but chances are that they will go away. These particular examples – with diameters 130-140 meters - would only cause havoc at the regional or continental scale; objects with diameter below 20 meters or so may be ignored because they pretty much burn in the atmosphere. The chances of collision are 1 in 500 and 1 in 1800 or so, respectively.
It's actually rather unlikely that a major enough collision in the next 2-3 decades is being overlooked by this program; it is reliable enough. For this reason, we would have enough time to prepare. Various methods to deflect the asteroids by nuclear detonations that "peel" a piece from the asteroid etc. have been discussed – they even made it to movies – but of course that there is no particular agreed policy because there is no particular threat.
More generally, I want to say that it is kind of irrational to be preparing for a truly dangerous event if the event only occurs less than once per million years. There are many threats around us that are arguably much more likely to kill us – e.g. various biological scenarios (pandemics). If you imagine that at some point, the threat becomes really high but it is more than 20 or 30 or more years in the future, it would still be reasonable not to panic and leave at least a decade for a careful thinking, planning, and competition between projects, which could be realized in the rest of the time. The technological progress and improvement of ideas could be substantial and probably more beneficial than the efforts to "solve it right away".
Also, I don't think it's right to suggest that the solution would be led by some international bureaucracy under the United Nations etc. It's pretty clear that one agency, most likely NASA, would lead all the activities so it would be de facto done by one nation (or at most, one confederation such as the EU and ESA), depending on the likely location of the collision point and other things. The U.N.-based institutions have been found largely dysfunctional in their treatment of sufficiently hi-tech challenges due to corruption and the unprofessional, low-tech "activist" approach by most participants.
