summaryrefslogtreecommitdiff
path: root/rt/share/static/js/titlebox-state.js
blob: d4053390b6eb055478c7e8f31047a51ad95a43ac (plain)
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
function createCookie(name,value,days) {
    var path = RT.Config.WebPath ? RT.Config.WebPath : "/";

    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else
        expires = "";
    
    document.cookie = name+"="+value+expires+"; path="+path;
}

function loadTitleBoxStates() {
    var cookies = document.cookie.split(/;\s*/);
    var len     = cookies.length;

    for (var i = 0; i < len; i++) {
        var c = cookies[i].split('=');
        
        if (c[0].match(/^TitleBox--/)) {
            var e   = document.getElementById(c[0]);
            if (e) {
                var e2  = e.parentNode;
    
                if (c[1] != 0) {
                    set_rollup_state(e,e2,'shown');
                }
                else {
                    set_rollup_state(e,e2,'hidden');
                }
            }
        }
    }
}