var AO_ar = new Array();
var D_ar = new Array();
var L_ar = new Array();
var V_ar = new Array();

function AllOpl(Nr,Ti,Op,Lo,Dm,Va)
{
    this.nr = Nr;
    this.ti = Ti;
    this.op= Op
    this.lo = Lo;
    this.dm = Dm;
    this.va = Va;
}

function Dom(Nr,Ti)
{
    this.nr = Nr;
    this.ti = Ti;
}

function Loc(Nr,Ti)
{
    this.nr = Nr;
    this.ti = Ti;
}

function Var(Nr,Ti)
{
    this.nr = Nr;
    this.ti = Ti;
}

function CrDSel()
{
    var l;
    var LB = document.opl_wijzer.domein;
    
    for (l = 0;l < D_ar.length;l++)
    {
        LB.options[LB.options.length] = new Option(D_ar[l].ti,D_ar[l].nr);
    }
}

function CrLSel()
{
    var l;
    var LB = document.opl_wijzer.locatie;
    
    for (l = 0;l < L_ar.length;l++)
    {
        LB.options[LB.options.length] = new Option(L_ar[l].ti,L_ar[l].nr);
    }
}

function CrVSel()
{
    var l;
    var LB = document.opl_wijzer.variant;
    
    for (l = 0;l < V_ar.length;l++)
    {
        LB.options[LB.options.length] = new Option(V_ar[l].ti,V_ar[l].nr);
    }
}

function CrSOSel()
{
    var l;
    var LB;
    
    var Lo;
    var Dm;
    var Va;

    var OpLo;
    var OpDo;
    var OpVa;

    LB = document.opl_wijzer.opleidingselectie;
    
    Lo = document.opl_wijzer.locatie.value;
    Dm = document.opl_wijzer.domein.value;
    Va = document.opl_wijzer.variant.value;
    

    LB.options.length = null;
    
    for (l = 0;l < AO_ar.length;l++)
    {
        OpLo = AO_ar[l].lo;
        OpDo = AO_ar[l].dm;
        OpVa = AO_ar[l].va;

        // Niets ingevuld, toon alles
        if(Lo=='' && Dm=='' && Va=='')
        {
            LB.options[LB.options.length] = 
                new Option(AO_ar[l].ti,AO_ar[l].nr);
        }

        // Een select ingevuld
        if(Lo!='' && Dm=='' && Va=='')
        {
            if(OpLo==Lo)
            {
                LB.options[LB.options.length] = 
                    new Option(AO_ar[l].ti,AO_ar[l].nr);
            }
        }

        if(Lo=='' && Dm!='' && Va=='')
        {
            if(OpDo==Dm)
            {
                LB.options[LB.options.length] = 
                    new Option(AO_ar[l].ti,AO_ar[l].nr);
            }
        }

        if(Lo=='' && Dm=='' && Va!='')
        {
            if(OpVa==Va)
            {
                LB.options[LB.options.length] = 
                    new Option(AO_ar[l].ti,AO_ar[l].nr);
            }
        }

        // Twee selects ingevuld
        if(Lo!='' && Dm!='' && Va=='')
        {
            if(OpLo==Lo && OpDo==Dm)
            {
                LB.options[LB.options.length] = 
                    new Option(AO_ar[l].ti,AO_ar[l].nr);
            }
        }

        if(Lo=='' && Dm!='' && Va!='')
        {
            if(OpDo==Dm && OpVa==Va)
            {
                LB.options[LB.options.length] = 
                    new Option(AO_ar[l].ti,AO_ar[l].nr);
            }
        }

        if(Lo!='' && Dm=='' && Va!='')
        {
            if(OpLo==Lo && OpVa==Va)
            {
                LB.options[LB.options.length] = 
                    new Option(AO_ar[l].ti,AO_ar[l].nr);
            }
        }
        
        // Drie selects ingevuld
        if(Lo!='' && Dm!='' && Va!='')
        {
            if(OpLo==Lo && OpDo==Dm && OpVa==Va)
            {
                LB.options[LB.options.length] = 
                    new Option(AO_ar[l].ti,AO_ar[l].nr);
            }
        }
    }
}

function RedirectPage(Nr)
{
    if(Nr!='')
    {
        var sUrl = 'smartsite.shtml?id='+Nr+'&ch=DEF';

        window.location.href = sUrl;
    }
    else
    {
        alert('Selecteer een opleiding!');
    }
}

// End of file