Your iMac, sadly, does not support Mountain Lion as the hardware it uses is slightly too old. However, the good news is that you can upgrade to a release of OS X that is two versions ahead of yours (OS X 10.6.x) and this would allow you to run a much more modern version of Safari.
Going from OS X 10.4.x to OS X 10.6.x is a paid upgrade.
For a limited time, it may be available via the Apple Online store in the US for $19.99:http://store.apple.com/us/product/MC573/mac-os-x-106-snow-leopard
It is no longer officially sold in most stores but you can also get it via telephone.
Call 1-800-MY-APPLE (1-800-692-7753) and tell them you want the Snow Leopard upgrade which they can send on CD for around $20 USD shipped.
Once you have the disc, the upgrade process is fairly simple. After the install, keep running System Preferences > Software Update until no more updates are offered.
You should then be left with OS X 10.6.8 and Safari 5.1.9. OS X 10.6.8 will also allow the use of other web browsers, such as Firefox that may be newer, as well.
Until you have a chance to upgrade, there is another option for use as a web browser, too. There is a custom build of FireFox for OS X 10.4 running on Intel based Macs such as yours. It is entirely unsupported and may not work for you but it may be worth a try on a purely temporary basis.http://code.google.com/p/tenfourfox/wiki/IntelBuildIf you continue to have questions on this topic, just reply back to this discussion. I will be more than happy to work with you further. Hopefully, this info will answer your question.
If so please, please remember that when you are asked to give a rating, you are rating my personal service only and not this website itself or your issue.
Thanks and good luck,