Renamed helpers to correspond to renamed Controller classes.
[merb_radiant.git] / public / javascripts / .svn / text-base / pngfix.js.svn-base
blobe821d3986b31f8f56c1df00507b87155725e402a
1 /**
2  * Correctly handle PNG transparency in Win IE 5.5 & 6.
3  * http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.
4  * 
5  * Use in <HEAD> with DEFER keyword wrapped in conditional comments:
6  * 
7  *   <!--[if lt IE 7]>
8  *   <script defer type="text/javascript" src="pngfix.js"></script>
9  *   <![endif]-->
10  * 
11  */
13 var arVersion = navigator.appVersion.split("MSIE"),
14     version = parseFloat(arVersion[1]),
15     filters = false;
16     
17 try { filters = !!document.body.filters }
18 catch (e) {}
20 if (version >= 5.5 && filters) {
21   $A(document.images).each(function(img) {
22     if (!img.src.toLowerCase().endsWith('png')) return;
23     
24     var span = new Element('span', { id: img.id, className: img.className, title: (img.title || img.alt) }).
25       setStyle({
26         display: 'inline-block',
27         width: img.width + 'px',
28         height: img.height + 'px',
29         filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + img.src + '", sizingMethod="scale")'
30       }).
31       setStyle(img.style.cssText);
32     
33     if (img.align == "left")       span.setStyle("float: left");
34     else if (img.align == "right") span.setStyle("float: right");
35     if (img.parentElement.href)    span.setStyle("cursor: hand");
36     
37     $(img).replace(span);
38   });