####
//construct new QuickSearch object, passing inventory JSData object
var myQuickSearch = new QuickSearch(invJSData);
function initQuickSearch(){
// this is to turn off sorting in the api; options will be displayed in JSDO order
criteriaList[MODEL_NAME].setIsPreSorted(true);
criteriaList[TRIM_NAME].setIsPreSorted(true);
myQuickSearch.setShowNullSearchTypes(false);
myQuickSearch.init(document.forms.quickSearchForm);
// if there is no "new" inventory, the "New" option does not appear in the dropdown.
if (myQuickSearch.hasNew) setSearchType("new");
else if (myQuickSearch.hasPreowned) setSearchType("preowned");
}
/* Call in the onClick of the search dropdown */
setSearchType = function(newType) {
// REQUIRED: this kicks off the dropdown population.
myQuickSearch.setSearchType(newType);
// by default it will load all makes; this is how you get it to load models for just one make.
if (newType == "preowned") myQuickSearch.setMake("Subaru");
}