/* 
+===============================================================+
|	e107 website system v6
|	Sleight Plugin for e107 v6
|	sleight.js
|
|	©William Moffett II 2003
|	http://e107.net
|	que@e107.net
|
|	Released under the terms and conditions of the
|	GNU General Public License (http://gnu.org).
|
|	Based on Youngpup’s Sleight code snippet for achieving PNG alpha transparency in Win IE 5.5+.
|	Be shure to visit (http://youngpup.net)
|
|	Sleight makes PNG graphics work as normal in Win32 IE5.5+.
|
|	PNG graphics are not officially supported by that browser, but there is a hack that I have taken advantage of here.
|
|	Drew, from allinthehead.com made some updates to Sleight to make it work for PNGs specified using the CSS background-image syntax.
|	Note that this doesn't cover background images which are tiled.
|	Visit (http://www.allinthehead.com/retro/69) for more info
|
+===============================================================+
*/


if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	document.writeln('<style type="text/css">img { visibility:hidden; } </style>');
	window.attachEvent("onload", fnLoadPngs);
}

function fnLoadPngs() {
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);

	for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--) {
		if (itsAllGood && 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='scale')"
			img.src = "e107_plugins/sleight_menu/x.gif";
		}
		img.style.visibility = "visible";
	}
}