/**
 * Clase que corrige el bug de png sobre ie5 e ie6
 * @author Luis Pirir <lpirir@solucionweb.com, luispirir@gmail.com>
 **/

pngFix = Class.create ({

	version : parseFloat(navigator.appVersion.split('MSIE')[1]),

	initialize : function () {
	
		if ( this.version > 5.5 && this.version < 7 && document.body.filters ) {
			
			$$('img').each( function (image) {
			
				if ( image.src.endsWith('png')) {
					
					var imgID = (image.id) ? "id='" + image.id + "' " : ""
					var imgClass = (image.className) ? "class='" + image.className + "' " : ""
					var imgTitle = (image.title) ? "title='" + image.title + "' " : "title='" + image.alt + "' "
					var imgStyle = "display:inline-block;" + image.style.cssText 
					if (image.align == "left") imgStyle = "float:left;" + imgStyle
					if (image.align == "right") imgStyle = "float:right;" + imgStyle
					if (image.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
					var strNewHTML = "<span " + imgID + imgClass + imgTitle
					+ " style=\"" + "width:" + image.width + "px; height:" + image.height + "px;" + imgStyle + ";"
					+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
					+ "(src=\'" + image.src + "\', sizingMethod='scale');\"></span>" 
					image.outerHTML = strNewHTML
				}
				
			});

		}

	}
});