add an RSS feed to describe a barrel's recent changes
[diogenes.git] / htdocs / phplayersmenu / layerstreemenu-cookies.js
CommitLineData
6855525e
JL
1// PHP Layers Menu 3.1.1 (C) 2001-2003 Marco Pratesi (marco at telug dot it)
2
3function setLMCookie(name, value) {
4 document.cookie = name + "=" + value;
5}
6
7function getLMCookie(name) {
8 foobar = document.cookie.split(name + "=");
9 if (foobar.length < 2) {
10 return null;
11 }
12 tempString = foobar[1];
13 if (tempString.indexOf(";") == -1) {
14 return tempString;
15 }
16 yafoobar = tempString.split(";");
17 return yafoobar[0];
18}
19
20function parseExpandString() {
21 expandString = getLMCookie("expand");
22 expand = new Array();
23 if (expandString) {
24 expanded = expandString.split("|");
25 for (i=0; i<expanded.length-1; i++) {
26 expand[expanded[i]] = 1;
27 }
28 }
29}
30
31function parseCollapseString() {
32 collapseString = getLMCookie("collapse");
33 collapse = new Array();
34 if (collapseString) {
35 collapsed = collapseString.split("|");
36 for (i=0; i<collapsed.length-1; i++) {
37 collapse[collapsed[i]] = 1;
38 }
39 }
40}
41
42parseExpandString();
43parseCollapseString();
44
45function saveExpandString() {
46 expandString = "";
47 for (i=0; i<expand.length; i++) {
48 if (expand[i] == 1) {
49 expandString += i + "|";
50 }
51 }
52 setLMCookie("expand", expandString);
53}
54
55function saveCollapseString() {
56 collapseString = "";
57 for (i=0; i<collapse.length; i++) {
58 if (collapse[i] == 1) {
59 collapseString += i + "|";
60 }
61 }
62 setLMCookie("collapse", collapseString);
63}
64