/ navigation into a dropdown list for small screens
* https://github.com/lukaszfiszer/selectnav.js
*
* modified by Luka Peharda (if sub nav was empty "undefined" was returned instead of empty string)
* modified by Zoran Jambor (added check to ensure that addEventListener doesn't break the script if there's no element to attach it to)
* modified by Zoran Jambor (removed navigation item from the list; it was automatically added to list by the script)
*/
window.selectnav=function(){"use strict";var a=function(a,b){function c(a){var b;a||(a=window.event),a.target?b=a.target:a.srcElement&&(b=a.srcElement),3===b.nodeType&&(b=b.parentNode),b.value&&(window.location.href=b.value)}function d(a){var b=a.nodeName.toLowerCase();return"ul"===b||"ol"===b}function e(a){for(var b=1;document.getElementById("selectnav"+b);b++);return a?"selectnav"+b:"selectnav"+(b-1)}function f(a){m++;var b=a.children.length,c="",g="",o=m-1;if(!b)return m--,"";if(o){for(;o--;)g+=k;g+=" "}for(var p=0;b>p;p++){var q=a.children[p].children[0];if("undefined"!=typeof q){var r=q.innerText||q.textContent,s="";if(h&&(s=-1!==q.className.search(h)||-1!==q.parentNode.className.search(h)?n:""),i&&!s&&(s=q.href===document.URL?n:""),c+='",j){var t=a.children[p].children[1];t&&d(t)&&(c+=f(t))}}}return 1===m&&l&&(c='"+c),1===m&&(c='"),m--,c}if(a=document.getElementById(a),a&&d(a)&&"insertAdjacentHTML"in window.document.documentElement){document.documentElement.className+=" js";var g=b||{},h=g.activeclass||"active",i="boolean"==typeof g.autoselect?g.autoselect:!0,j="boolean"==typeof g.nested?g.nested:!0,k=g.indent||"→",l=g.label||"",m=0,n=" selected ";a.insertAdjacentHTML("afterend",f(a));var o=document.getElementById(e());return o&&o.addEventListener&&o.addEventListener("change",c),o&&o.attachEvent&&o.attachEvent("onchange",c),o}};return function(b,c){a(b,c)}}();