|No, all graphics cards are NOT the same size. The newer they get, the larger they get.The ATI 5770 is ~8.5 inches, so make sure that will fit in your HP case. The GT240 you are using is anywhere from 6.5-7.5 inches, depending on who made it. I will say that the ATI 5770 is not a really good value for its performance. For $200 you can get an ATI 5870, which is almost double the performance.|
Anyways, its really up to you. The bottom line is you are sinking money into a case and motherboard that are outdated and not suited to what you want to do. Recommendation is to build a better machine, and not try to keep that one alive. If you have to stay with that HP, I gave you links with motherboards, CPUs, and other parts that are on sale at Newegg for as cheap as you'll find anywhere. Go with our recommendations and get a Micro-ATX motherboard, an AMD CPU, new power supply, and a graphics card.
The new Sandy Bridge Intel CPU's, i.e. the Core i3 2100, the Core i5 2500, and the Core i7 2600, are all WAY better than anything AMD has on the market right now. They are somewhat affordable, however you will still end up spending over $200 on a CPU/motherboard combo. Add in another $40 for new DDR3 RAM, and another $200 for PSU and graphics card...shop around those links I gave you and figure what works with your budget, and what it is you really want to do. Upgrade now with those cheap parts and you'll want to upgrade again in a year or two. Get a solid brand new machine now and you'll be set for 3-4 years. Up to you.
EDIT: Also, you can NOT use an Intel CPU with an AMD motherboard, or an AMD CPU with an Intel motherboard. No way, no how.