var xmlhttp = false; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); } function refreshSelects (classes, codes) { if (xmlhttp) { if (xmlhttp.readyState >= 1 && xmlhttp.readyState <= 3) { xmlhttp.abort(); } var descript, url = 'webshop_get_accus.asp?type=' + classes + '&codes=' + codes + '&l=EN'; //alert(url); xmlhttp.open("GET", url, true); xmlhttp.onreadystatechange = function () { if(xmlhttp.readyState == 4) { var optctr, selCode, sel, result; result = new Array(); response = xmlhttp.responseText; // alert(response); eval(response); switch(classes) { case 'appl': sel = selAppl; descript = '- Soort voertuig -'; break; case 'brand': sel = selBrand; descript = '- Selecteer merk -'; break; case 'model': sel = selModel; descript = '- Selecteer model -'; break; case 'type': sel = selType; descript = '- Selecteer type -'; break; case 'date': sel = selDate; descript = '- Vanaf bouwjaar -'; break; case 'conversion': sel = selConvCode; descript = '- Selecteer nummer -'; break; } optctr = 0; sel.options.length = 0; sel.options[optctr] = new Option(descript, "", false); for(var code in result) { optctr++; sel.options[optctr] = new Option(""+code+"", result[code], false, false); } // valt er iets te kiezen ? if (optctr > 0) sel.disabled = false; progressdone = true; sortModels(); } } xmlhttp.send(null); } } function sortModels() { var cl = document.getElementById('veh_model'); if (cl && cl.length > 0) { var clTexts = new Array(), i; for(i = 0; i < cl.length; i++) { clTexts[i] = cl.options[i].text.toUpperCase() + "," + cl.options[i].text + "," + cl.options[i].value + "," + cl.options[i].selected; } clTexts.sort(); for(i = 0; i < cl.length; i++) { var parts = clTexts[i].split(','); cl.options[i].text = parts[1]; cl.options[i].value = parts[2]; if(parts[3] == "true") cl.options[i].selected = true; else cl.options[i].selected = false; } } }