 (function($) {

   $.fn.timPng = function() {





     this.each(function() {
        if ($('body').css("maxHeight")==undefined){



            if ($(this).css("background-image")!=undefined){
            var bg=($(this).css("background-image"));

                if (bg.toLowerCase().indexOf("png")>-1){
                var lastPosSlash=bg.indexOf('h');
                var lastPosG=bg.lastIndexOf('g');
                bg=bg.substring(lastPosSlash, lastPosG+1);

                $(this).not('img').css('filter','progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+bg+'",sizingMethod="crop")').css('background-image','none').addClass("png_replace");


        };
            };







        if ($(this).is('img')){
                if ($(this).attr("src").toLowerCase().indexOf("png")>-1){
                var width=$(this).width();
                var height=$(this).height();
            $(this).wrap('<span class="png_replace" style="width:'+width+';height:'+height+';display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+$(this).attr("src")+'\',sizingMethod=\'crop\')"></span>');
            $(this).hide();
};
        };






};
     });

     return this;

   };

 })(jQuery);




