Typically video abnormalities (lines, stuck pixels, jagged lines, etc) and freezing seen together are a result of a failed/failing video card. You might boot the Mac in Safe mode (hold Shift while booting, you can let go once you reach the Apple w/ spinning gear) to see if the problem persists, if it does then you can likely rule out a software issue.
The ATI Radeon X1600 cards in these did seem to fail ''somewhat'' more frequently than other models but not quite widespread enough for Apple or ATI to initiate a repair extension program. A quick search though shows a video of someone with what sounds like similar symptoms on a similar iMac. [http://www.youtube.com/watch?v=viaVumyro3o|video of distorted video on iMac]
It's likely a safe bet that the video card is the culprit here. If you can source a replacement (ebay, Powerbookmedic.com, etc) then you can use the guide below to replace it.
[guide|5214|Video card replacement in iMac]
Good luck!