1jQuery(function(){
2
3    /*
4     * set class 'curid' on all navigation entries that point to the current page
5    */
6
7    baseurl = window.location.protocol + '//' + window.location.hostname;
8
9    paths = window.location.pathname.split('/');
10    path2 = paths.slice(0,2).join('/');
11    path3 = paths.slice(0,3).join('/');
12    path4 = paths.slice(0,4).join('/');
13    patharr = [path2, path3, path4];
14    for (p in patharr) {
15        if (patharr[p].substr(-1) === "/") {
16            patharr.push(patharr[p]+'start');
17        }
18    }
19
20    // keep only unique entries
21    var patharrtmp = patharr;
22    patharr = patharrtmp.sort().filter(function(item, pos, ary) {
23        return !pos || item != ary[pos - 1];
24    });
25
26	// wrap with curid-span as php would do
27    for (p in patharr) {
28        dest = patharr[p];
29        linkstocur = jQuery('div.sidebar_box a[href="'+baseurl+dest+'"]');
30        linkstocur.wrap("<span class='curid'></div>");
31    }
32
33
34    /*
35     * toggle the menu onclick in mobile view
36    */
37    jQuery("#toggle_space").on("click touchstart", function(e) {
38         jQuery("#left-row").slideToggle("slow");
39         e.preventDefault();
40    });
41
42
43});
44