
(function($) {

jQuery.fn.pngReplace = function(settings) {

	// Settings
	settings = jQuery.extend({
		
	}, settings);

	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {

		//fix images with png-source
		jQuery(this).find("img[src$=.png]").each(function() {
			var tempSrc = jQuery(this).attr('src');
			jQuery(this).attr('src',tempSrc.replace(".png", ".gif"));
		});

		// fix css background pngs
		jQuery(this).find("*").each(function(){
			var bgIMG = jQuery(this).css('background-image');
			if(bgIMG.indexOf(".png")!=-1){
				jQuery(this).css('background-image',bgIMG.replace(".png", ".gif"));
			}
		});
		
		//fix input with png-source
		jQuery(this).find("input[src$=.png]").each(function() {
			var tempSrc = jQuery(this).attr('src');
			jQuery(this).attr('src',tempSrc.replace(".png", ".gif"));
		});
	
	}
	
	return jQuery;

};

})(jQuery);

