fix a problem by not inserting __MWTEMPLATESECTION for section titles that don't...
[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 relativeforfloats();
10 }
11
12 // png alpha transparency fixes
13 function fixalpha(){
14 // bg
15 if(version >= 5.5) {
16 var logoa = document.getElementById('p-logo').firstChild;
17 var bg = logoa.currentStyle.backgroundImage;
18 if (bg.match(/\.png/i) != null){
19 var mypng = bg.substring(5,bg.length-2);
20 logoa.style.backgroundImage = "none";
21 logoa.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mypng+"', sizingMethod='crop')";
22 }
23 }
24 }
25
26 // fix ie6 disappering float bug
27 function relativeforfloats() {
28 var bc = document.getElementById('bodyContent');
29 if (bc) {
30 var tables = bc.getElementsByTagName('table');
31 var divs = bc.getElementsByTagName('div');
32 }
33 setrelative(tables);
34 setrelative(divs);
35 }
36 function setrelative (nodes) {
37 var i = 0;
38 while (i < nodes.length) {
39 if(((nodes[i].style.float && nodes[i].style.float != ('none') ||
40 (nodes[i].align && nodes[i].align != ('none'))) &&
41 (!nodes[i].style.position || nodes[i].style.position != 'relative')))
42 {
43 nodes[i].style.position = 'relative';
44 }
45 i++;
46 }
47 }