and how do I know for sure that the CPU will work ?
When choosing a replacement CPU, right off the top there are two things that will determine your choice: what Socket is on the motherboard, and is it an AMD or Intel chip. I did not research it, but if yours is a Socket AM2, then any CPU you can find that is a Socket AM2 will work. Additional thought: theoretically, AM3 is supposed to be backwards compatible with AM2, but since this is a Foxcon board do not count on it, it probably won't. Stick with older AM2 chips.
I'm thinking that I can use the same Heatsink what do you think?
In theory it should. The CPU simply drops into the socket & locks down and the mountings should not interfere with that. If you replace the motherboard, that is an entirely different matter, but that doesn't apply here. Foxcon does not make their own chips so they have to conform to AMD standards for mounting sockets.
does this mean any CPU in this family 95 watts or less will work?
That gets "iffy". In theory it should be ok if the power supply is adequate enough. HP probably supplied you with a PS somwhere in the 250-300Watt area, but check it out. Please see my comments below.
If I may add some thoughts based on dealing with a lot of older HPs with Foxcon boards:
Foxcon is a jobber who specializes in low-quality, mass produced mainboards for commercial manufactures such as HP. It is very common for older HP units to have failed Foxcon mainboards, I get them in all the time. In street terms, Foxconn boards are junk. There is a chance in the foreseeable future that board will fail, so take it into consideration.
Second, my respectful suggestion is not to attempt to make a gaming computer out of this old unit. You are better off saving your money and building a unit from scratch than trying to make a fast machine out of a slow machine. It is true that a faster CPU will make a difference, but don't forget that the older, slow DDR2 memory, and the slow FSB is going to create a data-flow bottleneck on the system so that it will not be able to perform at the full clock speed of the upgraded CPU. This goes especially if your friend wants to game online. Just a thought.
The problem with a retail computer is that the manufacturer engineered that CPU to go with that mainboard, taking into consideration the overall system, and there is the problem of upgrading.