﻿/*Custom*/

function HandleShortcuts() {
    var shortcutlists = new Array("Citizen", "Buisness", "Municipality", "Policy");
    for (i = 0; i < shortcutlists.length; i++) {
        var elm = document.getElementById(shortcutlists[i]);
		elm.style.height = "auto";
        var links = elm.getElementsByTagName("A");
        var form = document.createElement("form");
        var select = document.createElement("select");        
        //hide ul
        elm.getElementsByTagName("ul")[0].style.display = 'none';
        //add onchange event
        select.onchange = function() {
            window.location = this.options[this.selectedIndex].value;
         }
        //select.setAttribute("onchange", "window.open(this.options[this.selectedIndex].value,'_main')")
        var firstOp = document.createElement("option");
        firstOp.appendChild(document.createTextNode("Genveje..."));
        select.appendChild(firstOp);
        for (y = 0; y < links.length; y++) {
            var op = document.createElement("option");
            var link = links[y];
            op.value = link.href;
           
            op.appendChild(document.createTextNode(link.innerHTML.replace('»','')));
            select.appendChild(op);
        }
        form.appendChild(select);
        elm.appendChild(form);
        
    }
} /*HandleShortcuts*/