Question about earnest money

If you put up earnest/hand money, does it go toward the deposit or is it totally separate? As in, if you submit $500.00 earnest money will it be included in your downpayment or not? I have heard conflicting statements regarding this. Some people say it does, some say it does not.

If it helps, I am in Virginia.
4 answers 4