/**
 * Automatically fixes alpha transparency for PNGs in IE < 7
 */

if (typeof Driebit == 'undefined') Driebit = {}

Driebit.fixPng = function (element) {
	var origSource = element.get('src');
	var blankImg   = '/images/system/transparent.gif';

	element.set('src', blankImg);
	element.setStyle('filter', 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + origSource + '")');
}

if (typeof XMLHttpRequest == 'undefined' && Browser.Engine.trident) { //IE below 7 does not have XMLHttpRequest()
	window.addEvent('domready', function () {
		$$('img[src$=png]', 'input[src$=png]').each(function (el) {
			if (!el.hasClass('nofix'))
				Driebit.fixPng(el);
		});
	});
}