// JavaScript Document
// should be called whenever a png needs to be displayed
function png(image, w, h)
{
	// check if the hack is needed
	if(needHack()){
		// if needed, use the obscure filter
		var imgTag = "src=\"images/transpixel.gif\"";
		imgTag += "style=\"width: " + w + "px; height: " + h + "px;";
		imgTag += "filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(";
		imgTag += "src='" + image + "', sizingMethod='scale')\"";
		
		document.write("<img " + imgTag + ">");
	} else {
		// otherwise, write the image as normal
		document.write("<img src=\"" + image + "\" width=\"" + w + "\" height=\"" + h + "\">");
	}
}

// determines if the browser needs the hack for the png
function needHack()
{
	var pos = navigator.userAgent.indexOf("MSIE ");

	if (pos == -1)
		return false;

	var version = navigator.userAgent.substring(pos + 5);
	// return if the browser is MSIE version 5.5 or 6 and running on Windows
	return (((version.indexOf("5.5") == 0) || (version.indexOf("6") == 0)) && (navigator.platform == ("Win32")));
}
