This solution is more elegant, less resource intensive and still valid:
https://vborg.vbsupport.ru/showthread.php?t=94416
Just by placing the javascript in an external file, you can significantly reduce page load and bandwidth simply because its cached in the end-user's browser. Not only that but IE7 and IE8 do not need this applied to PNG images since they support the Alpha Transparency natively.