2 <public:attach event="onpropertychange" onevent="propertyChanged()" />
3 <public:attach event="onbeforeprint" for="window" onevent="beforePrint()" />
4 <public:attach event="onafterprint" for="window" onevent="afterPrint()" />
10 * This script was created by Erik Arvidsson (erik(at)eae.net)
11 * for WebFX (http://webfx.eae.net)
14 * For usage see license at http://webfx.eae.net/license.html
17 * Created: 2001-??-?? First working version
18 * Updated: 2002-03-28 Fixed issue when starting with a non png image and
19 * switching between non png images
20 * 2003-01-06 Fixed RegExp to correctly work with IE 5.0x
21 * 2004-04-25 Fixed PNG image printing, eliminated need for external
22 * GIF file, fixed intermittent uninitialised variable
23 * error [by AG, <http://www.scss.com.au/family/andrew/> ]
24 * 2004-09-30 Reverted inline javascript image to transparent GIF. The
25 * new XP SP2 'security' measures prevented the JS image
26 * from working. [by AG]
27 * 2004-10-22 Rewrote fixImage() to try and work around some reported
28 * problems with PNGs vanishing! [by AG]
29 * 2004-12-12 Fixed problem with PNGs not being restored after
30 * printing. I have no idea how I missed this one! [by AG]
31 * 2005-03-26 Fixed supported RE mis-identifying IE 5.0/Win98 as
36 var IS_PNG = /\.png$/i;
37 var supported = /MSIE (5\.[5-9]|[6]\.[0-9]*)/.test(navigator.userAgent) && navigator.platform == 'Win32';
39 var blankSrc = '/images/blank.png';
40 if (supported) fixImage();
41 function propertyChanged() {
42 if (supported && event.propertyName == 'src') {
43 var i = element.src.lastIndexOf(blankSrc);
44 if (i == -1 || i != element.src.length - blankSrc.length) {
50 if (realSrc && element.src == realSrc) {
51 // this is an attempt to set the image to itself!
52 // pointless - leave the filter as-is, restore the blank image
53 element.src = blankSrc;
55 // set the image to something different
56 if (IS_PNG.test(element.src)) {
58 realSrc = element.src;
59 element.src = blankSrc;
60 element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + realSrc + "',sizingMethod='scale')";
62 // ordinary image - make sure the fix is removed
65 element.runtimeStyle.filter = '';
70 function beforePrint() {
73 element.src = realSrc;
74 element.runtimeStyle.filter = '';
78 function afterPrint() {