function vulPoplists(soort) {



   var url;



   if (soort=='MODELBRANDSTOF') {

     if (document.listfordealer.p_brandstof.value.length!=0) {

       document.listfordealer.p_sel_brandstof.value=document.listfordealer.p_brandstof.value;

     }

     url = '/owa_dima/owa/att_occsearch.getModellen_xml?p_merk='+document.listfordealer.p_merk.value+ 

                                                      '&p_code='+document.listfordealer.p_code.value+

                                                      '&p_brandstof='+document.listfordealer.p_brandstof.value;

   } else if (soort=='BRANDSTOF') {

     url = '/owa_dima/owa/att_occsearch.getBrandstof_ext_xml?p_code='+document.listfordealer.p_code.value+

                                                           '&p_merk='+document.listfordealer.p_merk.value+

                                                           '&p_model='+document.listfordealer.p_model.value;

   } else if (soort=='MERKMODEL'){

     url = '/owa_dima/owa/att_occsearch.getMerken_ext_xml?p_code='+document.listfordealer.p_code.value+

                                                        '&p_brandstof='+document.listfordealer.p_brandstof.value;

   } else if (soort=='MODEL') {

     url = '/owa_dima/owa/att_occsearch.getModellen_xml?p_merk='+document.listfordealer.p_merk.value+ 

                                                      '&p_code='+document.listfordealer.p_code.value+

                                                      '&p_brandstof='+document.listfordealer.p_brandstof.value;

   }



   xmlhttpHandler2(url, soort);

}



function xmlhttpResponse(dom,soort) {



  var poplist;

  var poplist_value;

  var selected_value;



  if (soort=='MERKMODEL') {

    poplist        = document.listfordealer.p_merk;

    poplist_value  = dom.getElementsByTagName('MERK');

    selected_value = document.listfordealer.p_merk.value;



    with (poplist) {

      for(i=options.length-1;i>0;i--) {

        options[i] = null;

      }

      // altijd een default option

      options[0] = new Option('alle merken','');

      // vul modellen

      for (var i=0; i<poplist_value.length;i++) {

        options[i+1] = new Option(poplist_value[i].firstChild.nodeValue,poplist_value[i].firstChild.nodeValue); 

        if (initCaps(poplist_value[i].firstChild.nodeValue)==initCaps(selected_value)){

          document.listfordealer.p_merk.options[i+1].selected=true;

        }

      }

      

      // Nu het model ophalen

      var url = '/owa_dima/owa/att_occsearch.getModellen_xml?p_merk='+document.listfordealer.p_merk.value+ 

                                                           '&p_code='+document.listfordealer.p_code.value+

                                                           '&p_brandstof='+document.listfordealer.p_brandstof.value;



      xmlhttpHandler2(url,'MODEL');

    }

  } else if (soort=='MODEL'||soort=='MODELBRANDSTOF'){

    poplist        = document.listfordealer.p_model;

    poplist_value  = dom.getElementsByTagName('MODEL');

    selected_value = document.listfordealer.p_sel_model.value;



    with (poplist) {

      for(i=options.length-1;i>0;i--) {

        options[i] = null;

      }

      // altijd een default option

      options[0] = new Option('Select een model','');

      // vul modellen

      for (var i=0; i<poplist_value.length;i++) {

        options[i+1] = new Option(initCaps(poplist_value[i].firstChild.nodeValue),poplist_value[i].firstChild.nodeValue); 

        if (initCaps(poplist_value[i].firstChild.nodeValue)==initCaps(selected_value)){

          document.listfordealer.p_model.options[i+1].selected=true;

        }

        

      }

      

      if(soort=='MODELBRANDSTOF'){

        //Nu brandstof vullen

        var url='/owa_dima/owa/att_occsearch.getBrandstof_ext_xml?p_code='+document.listfordealer.p_code.value+

                                                                '&p_merk='+document.listfordealer.p_merk.value+

                                                                '&p_model='+document.listfordealer.p_model.value;

        xmlhttpHandler2(url,'BRANDSTOF');

      }

      

    }

  } else {



    poplist        = document.listfordealer.p_brandstof;

    poplist_value  = dom.getElementsByTagName('SOORT');

    poplist_descr  = dom.getElementsByTagName('OMS');

    selected_value = document.listfordealer.p_sel_brandstof.value;



    with (poplist) {

      for(i=options.length-1;i>0;i--) {

        options[i] = null;

      }

      // altijd een default option

      options[0] = new Option('alle brandstoffen','');

      // vul brandstof

      for (var i=0; i<poplist_value.length;i++) {

        options[i+1] = new Option(initCaps(poplist_descr[i].firstChild.nodeValue),poplist_value[i].firstChild.nodeValue); 

        if (initCaps(poplist_value[i].firstChild.nodeValue)==initCaps(selected_value)){

          document.listfordealer.p_brandstof.options[i+1].selected=true;

        }

      }

    }

  }

}



function initCaps(in_str) {

   var out_str = '';

   out_str = in_str.substr(0,1).toUpperCase()+in_str.substr(1).toLowerCase();

   return out_str;

}

