/*
	Clint's Note:
	-------------
	found here: http://www.blakems.com/archives/000068.html

	this script is a combo of a script for background transparency at

		http://www.allinthehead.com/code/samples/bgsleight.js

	and a script for background and foreground transparency found at

		http://dsandler.org/js/ds-sleight.js

	however, the second script wasn't rendering the tiling background properly, hence the combination of the two scripts :)
*/

if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	window.attachEvent("onload", enableAlphaImages);
}

function enableAlphaImages(){
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
	if (itsAllGood) {
		for (var i=0; i<document.all.length; i++){
			var obj = document.all[i];
			var bg = obj.currentStyle.backgroundImage;
			var img = document.images[i];
			if (bg && bg.match(/\.png/i) != null) {
				var src = bg.substring(5,bg.length-2);
				obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
				obj.style.backgroundImage = "url(/images/spacer.gif)";
			} else if (img && img.src.match(/\.png$/i) != null) {
				var src = img.src;
				img.style.width = img.width + "px";
				img.style.height = img.height + "px";
				img.style.filter =
				"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='crop')"
				img.src = "/images/spacer.gif";
			}

		}
	}
}
