aboutsummaryrefslogtreecommitdiffstats
path: root/stylesheets/IEFixes.js
blob: 4fbc9a82169a1ac7dac0d974bb1bd9d331f04fcd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// IE fix javascript
var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
if (rslt != null ) var version = Number(rslt[1]);
else var version = 0;

window.attachEvent("onload", hookit);
function hookit() {
    fixalpha();
    relativeforfloats();
}

// png alpha transparency fixes
function fixalpha(){
    // bg
    if(version >= 5.5) {
        var logoa = document.getElementById('p-logo').firstChild;
        var bg = logoa.currentStyle.backgroundImage;
        if (bg.match(/\.png/i) != null){
            var mypng = bg.substring(5,bg.length-2);
            logoa.style.backgroundImage = "none";
            logoa.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mypng+"', sizingMethod='crop')";
        }
    }
}

// fix ie6 disappering float bug
function relativeforfloats() {
    var bc = document.getElementById('bodyContent');
    if (bc) {
        var tables = bc.getElementsByTagName('table');
        var divs = bc.getElementsByTagName('div');
    }
    setrelative(tables);
    setrelative(divs);
}
function setrelative (nodes) {
    var i = 0;
    while (i < nodes.length) {
        if(((nodes[i].style.float && nodes[i].style.float != ('none') ||
        (nodes[i].align && nodes[i].align != ('none'))) &&
        (!nodes[i].style.position || nodes[i].style.position != 'relative'))) 
        {
            nodes[i].style.position = 'relative';
        }
        i++;
    }
}