The drive is easy to put in.
1 - remove the AC Adapter and battery
2 - open up the case over the hard drive (usually 1 or 2 screws)
3 - lift up on the plastic tab to remove the hard drive
4 - remove the adapter over the SATA/IDE connector (it pulls off)
5 - unscrew 4 screws to remove the drive from the "caddy"
6 - reassemble in reverse.
Since the old drive is bad, you'll definitely need a set of recovery disks. If you don't have them now, you'll have to order them from the link I gave earlier (If in the USA). They usually arrive in a couple of days and it'll take a couple of hours to install.
Turn the computer on, open the CD/DVD drive and put Disk 1 in. Close the drive
Restart the system, tapping Esc as soon as the Compaq splash screen shows up.
Select the CD/DVD drive to boot from - and follow the prompts.
Here's a link to the product manual. Chapter 4 deals with replacing the hard drive: http://h10032.www1.hp.com/ctg/Manual/c01523646.pdf