/* New in this version: - Requires Mootools 1.3 - Automatically fixes background images Author: Andrew Ferri */ spacerPNGimg = bsc.site.scripts + 'scripts.2/asset/fixpng.2/spacer.gif'; window.addEvent('load',function(){ if (Browser.ie6) { $(document.body).getElements('*').each(function(el){ if (el.hasClass('nopngfix') == false) { var bg = el.getStyle('background-image'); if (bg.test('^url', 'i')) { var src = bg.substring(5, bg.length-2); if (src.test('\.png', 'i')) { el.fixPNG(); } } else { if (el.src) { if (el.src.test('\.png', 'i')) { el.fixPNG(); } } } } }); } }); Element.implement({ fixPNG: function() { if ((Browser.ie6) && (!this.retrieve('fixPNG'))) { if ((this.get('tag') == 'img') || (this.get('tag') == 'input')) { // Fix PNG img var size = this.getSize(); this.setStyles({ 'width': size.x, 'height': size.y, 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='scale')" }).setProperty('src', spacerPNGimg); } else { // Fix PNG background var bg = this.getStyle('background-image'); var src = bg.substring(5, bg.length-2); var mode = (this.getStyle('background-repeat') == 'no-repeat' ? 'crop': 'scale'); this.setStyles({ 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')", 'background-image': 'url(' + spacerPNGimg + ')' }); } this.store('fixPNG', true); } } });