
//benötigt jquery und jquery.timers
//keine Einstellungen benötigt

//
// benötigt jquery und jquery.timers
// IE PNG fix für bilder, visibility wird im script wieder hergestellt. 
//
var IEimages = 0, blankImg = 'bilder/leer.gif', zeigeBilderTimeout = false;

if ($.browser.msie && /MSIE (5\.5|6)/.test(navigator.userAgent)) {
	document.write(
		'<style type="text/css">' + 
		'* html img {visibility:hidden;}  ' + 
		'* html .nopngfix img {visibility:visible;}  ' + 
		'* html img.nopngfix {visibility:visible;}  ' + 
		'</style>'
	);
}

function fixPNG(image) {
	var imgtemp;
	imgtemp = image.src;
	if (imgtemp.slice(imgtemp.length - 4) == ".png" && $(image).css("visibility") == "hidden" && !$(image).hasClass("nopngfix")) {
		image.src = "";
		$(image).load(function(){
			var elm = image, src = image.src;
			if ((src && src.slice(src.length - blankImg.length) == blankImg) || typeof elm.filters == 'unknown') return;
			src = (src || '').replace(/\(/g, '%28').replace(/\)/g, '%29');
			
			elm.style.width = elm.offsetWidth + 'px';
			elm.style.height = elm.clientHeight + 'px';
			$(elm).load(function() {});
			var newelm = $(elm).clone(true);
			$(newelm).attr('src', blankImg);
			$(newelm).attr('oldsrc', src);
			$(elm).replaceWith(newelm);
			$(newelm).addClass('nopngfix');

			IEimages++;
			if (!zeigeBilderTimeout) {
				window.setTimeout("zeigeBilderIE()", 10);
			}
			zeigeBilderTimeout = true;
		});
		image.src = imgtemp;
	} else {
		if (!$(image).hasClass("nopngfix")) {
			$(image).css('visibility','visible');
		}
	}
}

$(document).ready(function(){
	if ($.browser.msie && /MSIE (5\.5|6)/.test(navigator.userAgent)) {
		$("img").each(function(){ fixPNG(this) });
	}
});

function zeigeBilderIE() {
	$("img").each(function(i){
		if ($(this).attr('oldsrc') && $(this).src != $(this).attr('oldsrc') && $(this).attr('oldsrc').slice(0,4) == "http") {
			var f = 'DXImageTransform.Microsoft.AlphaImageLoader';
			this.style.visibility = 'visible';
			this.style.filter = 'progid:' + f + '(src="' + this.oldsrc +	'",sizingMethod="scale")';
			$(this).removeAttr('oldsrc');
			IEimages--;
		}
	});
	if (IEimages > 0) window.setTimeout("zeigeBilderIE()",100);
	else zeigeBilderTimeout = false;
}


