
/**
 * Correctly handle PNG transparency in Win IE 5.5 or higher
 * Include this file using:
 * <!--[if gte IE 5.5]>
 * <script type="text/javascript" src="correctPNG.js"></script>
 * <![endif]-->
 */


function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.  
{
	for(var i=0; i < document.images.length; i++)
	{  
		var img = document.images[i];
		var imgName = img.src.toUpperCase();
		if (imgName.substring(imgName.length - 3, imgName.length) == "PNG")
		{
			var newElm = document.createElement('span');

			if(img.id) newElm.id = img.id;
			if(img.className) newElm.className = img.className;
			if(img.title) newElm.title = img.title;
			if(img.title) newElm.title = img.title;
			
			var imgStyle = img.style.cssText + ' display:inline-block;';
			if(img.parentElement.href) imgStyle += 'cursor: hand;';
			imgStyle += 'width: ' + img.width + 'px; height: ' + img.height + 'px;'
			+ ' top: ' + img.style.top + '; left: ' + img.style.left + ';'
			+ 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader'
			+ '(src=\'' + img.src + '\', sizingMethod=\'scale\');';
			
			//mapstraction
			if(img.getAttribute('north')) newElm.setAttribute('north', img.getAttribute('north'));
			if(img.getAttribute('east')) newElm.setAttribute('east', img.getAttribute('east'));
			if(img.getAttribute('south')) newElm.setAttribute('south', img.getAttribute('south'));
			if(img.getAttribute('west')) newElm.setAttribute('west', img.getAttribute('west'));
			
			newElm.style.cssText = imgStyle;
						
			img.parentNode.replaceChild(newElm, img);
			
			i--;
		}
	}
}
