Fortunately, I can do all of the above with conditional comments and I don't need any javascript.
Umm, your DirectX code isn't using any javascript?
That's correct. No script is needed at all. The call is just a straight HTML tag that happens to be supported by IE6. It looks like this. Note how I must supply it a blank transparent GIF as a background, in addition to the PNG file foreground in order for the DXImageTransform function to work:
<img align=right style="z-index: 3; position: absolute; right:5px; top:-77px; padding: 5 5 5 5;" src="2x2blank.gif" width="162" height="225" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='graphics/toon_hello_transparent.png', sizingMethod='scale')">
Encasing the above code in the IE conditional comments takes care of it for me. No script needed.
By transparent gif for IE5, do you mean you're serving up gif versions of all your PNG images or are you serving up blank rectangles?
I mean I've got two versions of each image: A transparent GIF with jaggy edges, and a transparent PNG with nice smooth edges. IE5 and earlier IE's get the GIF, everyone else gets the PNG. IE6 is a special case that uses that DirectX call.