2 <public:attach event="onpropertychange" onevent="iePNGFix(0)" />
4 <script type="text/javascript">
6 // IE5.5+ PNG Alpha Fix v1.0
7 // (c) 2004-2008 Angus Turnbull http://www.twinhelix.com
9 // This is licensed under the GNU LGPL, version 2.1 or later.
10 // For details, see: http://creativecommons.org/licenses/LGPL/2.1/
13 // This must be a path to a blank image, relative to the HTML document(s).
14 // In production use I suggest '/images/blank.gif' or similar. That's all!
15 if (typeof blankImg == 'undefined') var blankImg = 'blank.gif';
21 var f = 'DXImageTransform.Microsoft.AlphaImageLoader';
22 var sM = (currentStyle.backgroundRepeat == 'no-repeat') ? 'crop' : 'scale';
23 s = (s || '').replace(/\(/g, '%28').replace(/\)/g, '%29');
25 if (s && !(/IMG|INPUT/.test(nodeName) && !b) &&
26 currentStyle.width == 'auto' && currentStyle.height == 'auto')
28 style.width = offsetWidth + 'px';
29 style.height = clientHeight + 'px';
30 if (currentStyle.display == 'inline') style.display = 'inline-block';
35 filters[f].enabled = s ? true : false;
36 if (s) with (filters[f]) { src = s }
38 else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="' + sM + '")';
41 function iePNGFix(init)
43 if (!/MSIE (5\.5|6)/.test(navigator.userAgent) || typeof filters == 'unknown') return;
44 var evt = init ? { propertyName: 'src,background' } : event;
45 var isSrc = /src/.test(evt.propertyName);
46 var isBg = /background/.test(evt.propertyName);
47 var isClass = !init &&
48 ((this.className != this._png_class) && (this.className || this._png_class));
49 if (!(isSrc || isBg || isClass)) return;
50 this._png_class = this.className;
51 var blank = blankImg.match(/([^\/]+)$/)[1];
53 // Required for Whatever:hover support - erase any set BG if className changes.
54 if (isClass && ((style.backgroundImage.indexOf('url(') == -1) ||
55 (style.backgroundImage.indexOf(blank) > -1)))
57 setTimeout(function() { this.style.backgroundImage = '' }, 0);
61 if (isSrc && this.src && /IMG|INPUT/.test(nodeName))
63 if ((/\.png/i).test(src))
68 else if (src.indexOf(blank) == -1) filt();
71 var bgSrc = currentStyle.backgroundImage || style.backgroundImage;
72 if ((bgSrc + this.src).indexOf(blank) == -1)
74 var bgPNG = bgSrc.match(/^url[("']+(.*\.png[^\)"']*)[\)"']+[^\)]*$/i);
78 style.backgroundImage = 'url("' + blankImg + '")';
80 // Unclickable elements inside PNG backgrounds.
81 var tags = ['a', 'input', 'select', 'textarea', 'iframe', 'object'],
82 t = tags.length, tFix = [];
85 var elms = all.tags(tags[t]), e = elms.length;
86 while (e--) tFix.push(elms[e]);
89 if (t && (/relative|absolute/i).test(currentStyle.position))
90 alert('IEPNGFix: Children of positioned element are unclickable:\n\n<' +
91 nodeName + (id && ' id=' + id) + '>');
93 if (!(/relative|absolute/i).test(tFix[t].currentStyle.position))
94 tFix[t].style.position = 'relative';