]>
Commit | Line | Data |
---|---|---|
20a886a3 BP |
1 | // from w3schools\r |
2 | function getCookie(c_name)\r | |
3 | {\r | |
4 | if (document.cookie.length>0)\r | |
5 | {\r | |
6 | c_start=document.cookie.indexOf(c_name + "=");\r | |
7 | if (c_start!=-1)\r | |
8 | { \r | |
9 | c_start=c_start + c_name.length+1; \r | |
10 | c_end=document.cookie.indexOf(";",c_start);\r | |
11 | if (c_end==-1) c_end=document.cookie.length;\r | |
12 | return unescape(document.cookie.substring(c_start,c_end));\r | |
13 | } \r | |
14 | }\r | |
15 | return "";\r | |
16 | }\r | |
17 | // from w3schools\r | |
18 | function setCookie(c_name,value,expiredays)\r | |
19 | {\r | |
20 | var exdate=new Date();\r | |
21 | exdate.setDate(exdate.getDate()+expiredays);\r | |
22 | document.cookie=c_name+ '=' +escape(value)+\r | |
23 | ((expiredays==null) ? '' : ';expires='+exdate.toGMTString());\r | |
24 | }\r | |
25 | \r | |
26 | // Reimplementation of changeDisplayState\r | |
27 | function mychangeDisplayState( e )\r | |
28 | {\r | |
29 | var num=this.id.replace(/[^[0-9]/g,'');\r | |
30 | var button=this.firstChild;\r | |
31 | var sectionDiv=document.getElementById('dynsection'+num);\r | |
32 | if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){\r | |
33 | sectionDiv.style.display='block';\r | |
34 | button.src='open.gif';\r | |
35 | }else{\r | |
36 | sectionDiv.style.display='none';\r | |
37 | button.src='closed.gif';\r | |
38 | }\r | |
39 | \r | |
40 | setCookie( 'sectionDiv.style.display', sectionDiv.style.display );\r | |
41 | \r | |
42 | }\r | |
43 | \r | |
44 | window.onload = function myinitDynSections()\r | |
45 | {\r | |
46 | var divs=document.getElementsByTagName('div');\r | |
47 | var sectionCounter=1;\r | |
48 | for(var i=0;i<divs.length-1;i++){\r | |
49 | if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){\r | |
50 | var header=divs[i];\r | |
51 | var section=divs[i+1];\r | |
52 | var button=header.firstChild;\r | |
53 | if (button!='IMG'){\r | |
54 | divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);\r | |
55 | button=document.createElement('img');\r | |
56 | divs[i].insertBefore(button,divs[i].firstChild);\r | |
57 | }\r | |
58 | header.style.cursor='pointer';\r | |
59 | header.onclick=mychangeDisplayState;\r | |
60 | header.id='dynheader'+sectionCounter;\r | |
61 | button.src='closed.gif';\r | |
62 | section.id='dynsection'+sectionCounter;\r | |
63 | \r | |
64 | var display = getCookie( 'sectionDiv.style.display' );\r | |
65 | if ( display == '' ){\r | |
66 | section.style.display='block'; // default\r | |
67 | }else{\r | |
68 | section.style.display=display;\r | |
69 | }\r | |
70 | setCookie( 'sectionDiv.style.display', section.style.display );\r | |
71 | \r | |
72 | section.style.marginLeft='14px';\r | |
73 | sectionCounter++;\r | |
74 | }\r | |
75 | }\r | |
76 | }\r |