function replace_with_filter(src) {
	return "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='" + src + "')";
}

Element.implement({
	fixpng: function() {
		if (!Browser.Engine.trident) {
			return;
		}
		if (this.tagName == 'img' || this.tagName == 'input') { // hack image tags present in dom
			var src = this.getProperty("src");
			if (src) {
				if (src.match(/.*\.png([?].*)?$/i)) { // make sure it is png image
					// apply filter
					this.setStyle("filter", replace_with_filter(src));
					this.setStyle("width", this.getStyle("width"));
					this.setStyle("height", this.getStyle("height"));
					this.setProperty("src", "/images/pixel.gif");
					var position = this.getStyle("position");
					if (position != 'absolute' && position != 'relative') {
						this.setStyle("position", "relative");
					}
				}
			}
		} else { // hack png css properties present inside css
			var image = this.getStyle("backgroundImage");
			if (image.match(/^url\(["']?(.*\.png([?].*)?)["']?\)$/i)) {
				image = RegExp.$1;
				this.setStyle("backgroundImage", "none");
				this.setStyle("filter", replace_with_filter(image));
			}
		}
	}
});
