how does Avast find a new virus?

I had asked a question in a different post as to why we would email a virus in from the chest. Now that i have been athinking about it, how does avast recgonize a new virus…if it is new how could it detect it…for example when theh mydoom virus hit how did avast know it b4 the sig file?

Heuristic analys :

This is a term which is used by many anti-virus products when they use virus-non-specific tests to decide whether or not a program is infected. Simply put, the product examines the file to see whether or not it contains code which appears to be in some way virus-like, or is a standard uninfected file.
This means that, even if the heuristic testing finds what it thinks is an infected file, it does not know which virus is causing the infection. Heuristic methods also increase the prevalence of false alarms; however, they do enable products to detect some viruses which are not specifically known to that software.

Waldo