function getCookieVal (offset) { var endstr = document.cookie.indexOf(";", offset); if (endstr == -1) { endstr = document.cookie.length; } return unescape(document.cookie.substring(offset, endstr)); } function getCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) { return getCookieVal(j); } i = document.cookie.indexOf(" ", i) + 1; if (i == 0) { break; } } return ''; } function showArray(ar) { text = ''; for (key in ar) { text += '[' + key + '] = ' + ar[key] + '\n'; } alert(text); } // document.cookie = 'klapper=; expires=-1'; klapperTxt = getCookie('klapper'); klapper = new Array(); function klap(h,p,w) { if (document.getElementById) { div = document.getElementById('div_' + h + '_' + p); img = document.getElementById('img_' + h + '_' + p); if (div.style.display == 'none') { div.style.display = 'block'; img.src = 'images/min.gif'; img.title = ''; img.alt = '-'; if (w == '') { klapper[klapper.length] = h + '_' + p; } } else { div.style.display = 'none'; img.src = 'images/plus.gif'; img.title = ''; img.alt = '+'; if (w == '') { for (key in klapper) { if (klapper[key] == h + '_' + p) { klapper[key] = ''; break; } } } } if (w == '') { klapperTxt = ''; for (key in klapper) { if (klapper[key] != '') { klapperTxt += klapper[key] + ','; } } if (klapperTxt.substring(klapperTxt.length - 1, klapperTxt.length) == ',') { klapperTxt = klapperTxt.substring(0, klapperTxt.length - 1); } document.cookie = 'klapper=' + klapperTxt + '; domain=www.cacaochocolade.nl'; } } else { self.location.href = 'main.php?p=sitemap&h=' + h + '&g=' + p; } } if (klapperTxt != '') { klapper = klapperTxt.split(','); for (key in klapper) { h = klapper[key].substring(0, klapper[key].indexOf('_')); p = klapper[key].substring(klapper[key].indexOf('_') + 1, klapper[key].length); klap(h,p,'initialize'); } }