/*
Code adopted from :
http://homepage.ntlworld.com/bobosola.

Modified and Extended by http://webexcellence.net


Use in <HEAD> with DEFER keyword wrapped in conditional comments:
<!--[if lt IE 7]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->
*/


$(document).ready(function(){
	doFixPng();
});

function doFixPng() {
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])

	if ((version >= 5.5) && (document.body.filters)) 
	{
		$("img").each( function() {
			var imgName = this.src.toUpperCase();
			var imgType = imgName.substring(imgName.length-3, imgName.length);
			if (imgType == "PNG") {
				var imgID = (this.id) ? "id='" + this.id + "' " : "";
				var imgClass = (this.className) ? "class='" + this.className + "' " : "";
				var imgTitle = (this.title) ? "title='" + this.title + "' " : "title='" + this.alt + "' ";
				var imgStyle = "display:inline-block;" + this.style.cssText;
				if (this.align == "left") imgStyle = "float:left;" + imgStyle;
				if (this.align == "right") imgStyle = "float:right;" + imgStyle;
				if (this.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;

				var strNewHTML = "<span " + imgID + imgClass + imgTitle
					+ " style=\"" + "width:" + this.width + "px; height:" + this.height + "px;" + imgStyle + ";"
					+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
					+ "(src=\'" + this.src + "\', sizingMethod='scale');\"></span>";

				this.outerHTML = strNewHTML;
			}
		});
	}
}