/*
 
Correctly handle PNG transparency in Win IE 5.5 & 6.
http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.

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(){
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	if ( (version >= 5.5) ) 
	{
		$("img").each(function(){
			
			var imgName = $(this).attr("src").toUpperCase();
			
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
			{
				var imgID = ($(this).attr('id')) ? "id='" + $(this).attr('id') + "' " : "";
				var imgClass = $(this).attr('class') ? "class='" + $(this).attr('class') + "' " : "";
				var imgTitle = $(this).attr('title') ? "title='" + $(this).attr('title') + "' " : "title='" + $(this).attr('alt') + "' ";
				var imgStyle = "display:inline-block";
				if ($(this).attr('align') == "left")
					imgStyle = "float:left;" + imgStyle;
				if ($(this).attr('align') == "right")
					imgStyle = "float:right;" + imgStyle;
				if ( $(this).parent().attr('href') )
					imgStyle = "cursor:hand;" + imgStyle;
				var strNewHTML = "<div " + imgID + imgClass + imgTitle + " style=\"" + "width:" + $(this).attr('width') + "px; height:" + $(this).attr('height') + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + $(this).attr('src') + "\', sizingMethod='scale');\"></div>";
				$(this).before(strNewHTML);
				$(this).remove();

				
				//alert( $(this).html() );
			}	
		});
	
	}
});
