* logo url specified in the xhtml src, uses $wgLogo
[lhc/web/wiklou.git] / stylesheets / IEFixes.js
1 // IE fix javascript
2 var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
3 if (rslt != null ) var version = Number(rslt[1]);
4 else var version = 0;
5
6 window.attachEvent("onload", hookit);
7 function hookit() {
8 fixalpha();
9 if(version == 6) {
10 var wrapper = document.getElementById('tawrapper');
11 if (!wrapper) relativeforfloats();
12 }
13 }
14
15 // png alpha transparency fixes
16 function fixalpha(){
17 // bg
18 if(version >= 5.5) {
19 var logoa = document.getElementById('portlet-logo').firstChild;
20 var bg = logoa.currentStyle.backgroundImage;
21 if (bg.match(/\.png/i) != null){
22 var mypng = bg.substring(5,bg.length-2);
23 logoa.style.backgroundImage = "none";
24 logoa.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mypng+"', sizingMethod='image')";
25 }
26 }
27 }
28
29 // fix ie6 disappering float bug
30 function relativeforfloats() {
31 var bc = document.getElementById('bodyContent');
32 if (bc) {
33 var tables = bc.getElementsByTagName('table');
34 var divs = bc.getElementsByTagName('div');
35 }
36 setrelative(tables);
37 setrelative(divs);
38 }
39 function setrelative (nodes) {
40 var i = 0;
41 while (i < nodes.length) {
42 if(nodes[i].style.float != ('none'|null) ||
43 nodes[i].align != (''|null|'none'))
44 nodes[i].style.position = 'relative';
45 i++;
46 }
47 }