
<!--

var saElementIdsOfCategorySelects;


function fillSubCategoryPulldown(sElementId) {
  // declaration of variables
  var chel;       // the child select element to update
  var iLevel;     // the level in the tree which is the element that has been changed by the user and will be the parent element

  // determine the level in the tree that sElementId specifies
  iLevel = -1;
  if (sElementId) {
    iLevel = 0;
    while (iLevel < saElementIdsOfCategorySelects.length) {
      if (saElementIdsOfCategorySelects[iLevel] == sElementId) break;
      iLevel++;
    }
  }


    // fill the element and the elements below it (case ParentLevel: fill child)
    switch (iLevel) {
      case -1:
        chel = document.getElementById(saElementIdsOfCategorySelects[iLevel + 1]);
        chel.options.length = 0;
  
          chel.options[chel.options.length] = new Option('Geen voorkeur', '21,25,26,27,28,29,30,31,33,84,81,83,78,76,75,82,85,87,77,86,79,101,99,98,97,96,95,94,93,91,90,89,88,102,103');
  
          chel.options[chel.options.length] = new Option('Rood', '21,101,99,98,97,96,95,94,93,91,90,89,88,103');
  
          chel.options[chel.options.length] = new Option('Wit', '25,84,81,83,78,76,75,82,85,87,77,86,79,102');
  
          chel.options[chel.options.length] = new Option('Rosé', '26');
  
          chel.options[chel.options.length] = new Option('Mousserend', '27');
  
          chel.options[chel.options.length] = new Option('Zoete wijn', '28');
  
          chel.options[chel.options.length] = new Option('Port', '29');
  
          chel.options[chel.options.length] = new Option('Sherry', '30');
  
          chel.options[chel.options.length] = new Option('Overige', '33');
  
        chel.selectedIndex = 0;
        iLevel++;

  
            case 0:
              chel = document.getElementById(saElementIdsOfCategorySelects[iLevel + 1]);
              chel.options.length = 0;
  
    switch (document.getElementById(saElementIdsOfCategorySelects[0]).options[document.getElementById(saElementIdsOfCategorySelects[0]).selectedIndex].value) {

        case '21,25,26,27,28,29,30,31,33,84,81,83,78,76,75,82,85,87,77,86,79,101,99,98,97,96,95,94,93,91,90,89,88,102,103':

      chel.options[chel.options.length] = new Option('Geen voorkeur', '');

          break;

        case '21,101,99,98,97,96,95,94,93,91,90,89,88,103':

      chel.options[chel.options.length] = new Option('Geen voorkeur', '');

      chel.options[chel.options.length] = new Option('Fris, licht en elegant', '1');

      chel.options[chel.options.length] = new Option('Medium bodied, aromatisch', '2');

      chel.options[chel.options.length] = new Option('Medium bodied, aromatisch, houtgelagerd', '3');

      chel.options[chel.options.length] = new Option('Vol niet houtgelagerd', '4');

      chel.options[chel.options.length] = new Option('Vol en houtgelagerd', '5');

          break;

        case '25,84,81,83,78,76,75,82,85,87,77,86,79,102':

      chel.options[chel.options.length] = new Option('Geen voorkeur', '');

      chel.options[chel.options.length] = new Option('Fris, licht en elegant', '1');

      chel.options[chel.options.length] = new Option('Medium bodied, aromatisch', '2');

      chel.options[chel.options.length] = new Option('Medium bodied, aromatisch, houtgelagerd', '3');

      chel.options[chel.options.length] = new Option('Vol niet houtgelagerd', '4');

      chel.options[chel.options.length] = new Option('Vol en houtgelagerd', '5');

          break;

        case '26':

      chel.options[chel.options.length] = new Option('Geen voorkeur', '');

          break;

        case '27':

      chel.options[chel.options.length] = new Option('Geen voorkeur', '');

          break;

        case '28':

      chel.options[chel.options.length] = new Option('Geen voorkeur', '');

          break;

        case '29':

      chel.options[chel.options.length] = new Option('Geen voorkeur', '');

          break;

        case '30':

      chel.options[chel.options.length] = new Option('Geen voorkeur', '');

          break;

        case '33':

      chel.options[chel.options.length] = new Option('Geen voorkeur', '');

      chel.options[chel.options.length] = new Option('Olijfolie/azijn', 'Olijfolie/azijn');

      chel.options[chel.options.length] = new Option('glaswerk', 'glaswerk');

      chel.options[chel.options.length] = new Option('barbenodigdheden', 'barbenodigdheden');

      chel.options[chel.options.length] = new Option('kurkentrekkers', 'kurkentrekkers');

      chel.options[chel.options.length] = new Option('boeken', 'boeken');

      chel.options[chel.options.length] = new Option('thee', 'thee');

      chel.options[chel.options.length] = new Option('bier', 'bier');

      chel.options[chel.options.length] = new Option('water', 'water');

          break;

    }

              chel.selectedIndex = 0;
              iLevel++;
  
    }

}


/*
' function  : initializeSubCategorySelections
' overview  : initializes the updating of main category and subcategory select elements.
' arguments : the id's of the select elements starting with the top category
' return    :
' example   : initializeSubCategorySelections('maincategorie_select', 'subcategorie_select', 'subsubcategorie_select')
' note      : onChange events will be overwritten for the specified elements
*/
function initializeSubCategorySelections() {
  saElementIdsOfCategorySelects = arguments;

  for (var iArg = 0; iArg < saElementIdsOfCategorySelects.length; iArg++) {
    var chel = document.getElementById(saElementIdsOfCategorySelects[iArg]);
    if (chel)
      chel.onchange = function() { fillSubCategoryPulldown(this.id) }
  }

  fillSubCategoryPulldown()
}


// -->


