function IE_CorrectAlpha_PNG()
{
	if (IE6) {
		for (i = 0; i < document.images.length; i++) {
			img = document.images[i];
			if (img.width > 0 && img.height > 0) {
				
				imgExt = img.src.substring(img.src.length - 3, img.src.length);
				imgExt = imgExt.toUpperCase();
				if (imgExt == "PNG") {
					imgID = (img.id) ? "id='" + img.id + "' " : "";
					imgClass = (img.className) ? "class='" + img.className + "' " : "";
					imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
					imgStyle = "display:inline-block;" + img.style.cssText;
					if (img.align == "left") {
						imgStyle = "float:left;" + imgStyle;
					}
					else 
						if (img.align == "right") {
							imgStyle = "float:right;" + imgStyle;
						}
					strNewHTML = '<span ' + imgID + imgClass + imgTitle + ' style="width:' + img.width + 'px; height:' + img.height + 'px;' + imgStyle + ';' + 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' +
					img.src +
					'\', sizingMethod=\'scale\');"><\/span>';
					img.outerHTML = strNewHTML;
					i = i - 1;
				}
			}
		}
	}
}

//var userAgent=navigator.userAgent;

var IE6 = false, IE7 = false, IE8 = false,
FIREFOX2 = false, FIREFOX = false,
NETSCAPE7 = false, NETSCAPE = false,
OPERA9 = false, OPERA = false,
AUTRE = false;
var strChUserAgent = navigator.userAgent;
var intSplitStart = strChUserAgent.indexOf("(",0);
var intSplitEnd = strChUserAgent.indexOf(")",0);
var strChStart = strChUserAgent.substring(0,intSplitStart);
var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd);
var strChEnd = strChUserAgent.substring(strChEnd);

if(strChMid.indexOf("MSIE 8") != -1)
IE8 = true;
if(strChMid.indexOf("MSIE 7") != -1)
IE7 = true;
else if(strChMid.indexOf("MSIE 6") != -1)
IE6 = true;
else if(strChEnd.indexOf("Firefox/2") != -1)
FIREFOX2 = true;
else if(strChEnd.indexOf("Firefox") != -1)
FIREFOX = true;
else if(strChEnd.indexOf("Netscape/7") != -1)
NETSCAPE7 = true;
else if(strChEnd.indexOf("Netscape") != -1)
NETSCAPE = true;
else if(strChStart.indexOf("Opera/9") != -1)
OPERA9 = true;
else if(strChStart.indexOf("Opera") != -1)
OPERA = true;
else
AUTRE = true;

if (IE6)
{
	window.attachEvent("onload", IE_CorrectAlpha_PNG);
}


function BackgroundPNG(element, pngfile, sizing) //, div_ie, width, height
{
	var sizing = (sizing == null) ? "scale" : sizing;

	if (IE6) //&& div_ie == true
	{
		document.getElementById(element).style.background='';
	    document.getElementById(element).style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=' + sizing + ', src=\'' + pngfile + '\')';
	}
	/*else // && div_ie == false
	{
		document.getElementById(element).style.backgroundImage= 'url(' + pngfile + ')';
	}*/	
}