// code for Mozilla, etc. if (typeof XMLHttpRequest != 'undefined') { xmlHttp = new XMLHttpRequest(); } // code for IE else if (window.ActiveXObject) { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { xmlHttp = false; } } } var currentUrl = ""; var targetdiv = ""; var xmlHttpArray = new Array; function loadModels(make_id) { if (make_id !== '') { var thiscount = xmlHttpArray.length; // code for Mozilla, etc. if (typeof XMLHttpRequest != 'undefined') { xmlHttpArray[thiscount] = new XMLHttpRequest(); } // code for IE else if (window.ActiveXObject) { try { xmlHttpArray[thiscount] = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttpArray[thiscount] = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { xmlHttpArray[thiscount] = false; } } } xmlHttpArray[thiscount].open("GET", '/models_ajax.js?make_id='+make_id, true); changeCursor("wait"); // Setup a function for the server to run when it's done xmlHttpArray[thiscount].onreadystatechange = showModels; // Send the request xmlHttpArray[thiscount].send(null); } else { removeOptions('select_model'); addOption('select_model','','SELECT YOUR CAR MODEL...',true); document.getElementById('select_model').disabled = true; } } function showModels() { var thiscount = 0; for(thiscount in xmlHttpArray) { if (typeof xmlHttpArray[thiscount] != 'number') { if (xmlHttpArray[thiscount].readyState == 4) { var response = xmlHttpArray[thiscount].responseText; removeOptions('select_model'); eval(response); document.getElementById('select_model').disabled = false; xmlHttpArray[thiscount] = 0; changeCursor("default"); } } } } function changeCursor(cursorType) { //document.body.style.cursor = cursorType; } function removeOptions(id) { document.getElementById(id).options.length = 0; } function addOption(id,value,text,selected) { var x; x = document.getElementById(id).options.length; document.getElementById(id).options[x] = new Option(text,value); if (selected === true) { document.getElementById(id).selectedIndex = x; } }