function ortFinnsHar(hp, ort)
{
    for (var i=0; i<hp.length; i++)
        if (hp[i].ort == ort)
            return true;
    return false;
}

function fyllDestinationer(ortCmb, dstCmb)
{
    if (ortCmb.value == "-")
        {
            dstCmb.setAttribute("disabled", "disabled");
            dstCmb.options.length = 1;
            dstCmb.selectedIndex = 0;
        }
    else
        {
            dstCmb.removeAttribute("disabled");
            var v = dstCmb.value;
            dstCmb.options.length = 1;
            for (var i=0; i<destinationer.length; i++)
                if (ortFinnsHar(destinationer[i].hallplatser, ortCmb.value))
                    dstCmb.options[dstCmb.options.length] = new Option(destinationer[i].namn, destinationer[i].ID);
            dstCmb.value = v;
        }
}

    YAHOO.util.Event.onDOMReady(function() {
        var ortCmb = $("avreseort");
        var dstCmb = $("destination");
        fyllDestinationer(ortCmb, dstCmb);
        YAHOO.util.Event.addListener(ortCmb, "change", function(e) {
            fyllDestinationer(ortCmb, dstCmb);
        });
    });

