The Digital Clock Tutorial

Its wrong… The tutorial clock is wrong… Check it out here… The am pm thing doesn’t work…when its a time after 12 oclcok the clock says its “am” and when its b4 12 is also says “am”. Is there anyway to fix this becasue i need the:
if (hours<12) {

script too work… at the moment it does what ever is in the if space… not the else… WHY??