/*
*
*	$('.image').fixPNG('scale', true);
*
*/

(function ($) {
    if (!$) return;
    $.fn.extend({
        fixPNG: function(sizingMethod, forceBG) {
                if (!($.browser.msie)) return $(this);
                var emptyimg = "images/blank.gif"; //Path to empty 1x1px GIF goes here
                sizingMethod = sizingMethod || "scale"; //sizingMethod, defaults to scale (matches image dimensions)
                $(this).each(function() {
                        var isImg = (forceBG) ? false : $.nodeName($(this).get(0), "img");
						var imgname = (isImg) ? $(this).src : $(this).css('backgroundImage');
						var src = (isImg) ? imgname : imgname.substring(5,imgname.length-2);
                        $(this).css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + sizingMethod + "')");
                        if (isImg) {
                        	$(this).src = emptyimg;
                        } else {
                        	$(this).css("backgroundImage", "url(" + emptyimg + ")");
                        }
                });
                return $(this);
        }
    });
})(jQuery);
