var rawMakes="13%AMC%0%1~15%Acura%0%1~32%Alfa Romeo%0%1~84%Aston Martin%0%1~22%Audi%0%1~75%Austin Rover%0%1~23%BMW%0%1~03%Buick%1%1~04%Cadillac%1%1~01%Chevrolet%1%1~10%Chrysler%0%1~83%Daewoo%0%1~39%Daihatsu%0%1~11%Dodge%0%1~97%Don't Know/Other%0%1~09%Eagle%0%1~33%Ferrari%0%1~70%Fiat%0%1~06%Ford%0%1~47%GMC%1%1~80%Geo%0%1~14%Honda%0%1~77%Hummer%1%1~21%Hyundai%0%1~38%IHC%0%1~81%Infiniti%0%1~31%Isuzu%0%1~24%Jaguar%0%1~62%Jeep%0%1~40%Kia%0%1~78%Lada%0%1~72%Lamborghini%0%1~76%Land Rover%0%1~82%Lexus%0%1~07%Lincoln%0%1~74%Lotus%0%1~73%Maserati%0%1~16%Mazda%0%1~25%Mercedes Benz%0%1~08%Mercury%0%1~79%Merkur%0%1~17%Mitsubishi%0%1~18%Nissan%0%1~05%Oldsmobile%1%1~71%Opel%0%1~36%Peugeot%0%1~12%Plymouth%0%1~02%Pontiac%1%1~26%Porsche%0%1~35%Renault%0%1~34%Rolls Royce%0%1~27%Saab%1%1~65%Saturn%1%1~19%Subaru%0%1~54%Suzuki%0%1~20%Toyota%0%1~28%Volkswagen%0%1~29%Volvo%0%1~30%Yugo%0%1";



function Make(code, name, gm, active) {
  this.code = code;
  this.name = name;
  this.gm = gm;
  this.active = active;
  this.models = null;
}

// parse out all the makes into an array of make
// objects, makes[]

var rawMakesSplit = rawMakes.split('~');
var numMakes = rawMakesSplit.length;
var makes = new Array(numMakes);
var makeIndex = new Object();
for (var i = 0; i != numMakes; i++) {
  var fields = rawMakesSplit[i].split('%');
  makes[i] = new Make(fields[0], fields[1], fields[2], fields[3]);

  makeIndex[fields[0]] = makes[i];
}

// ie, writeMakes(0)
// used by the select dropdowns for what other models users are interested in;
// Writes out every make there is
function writeMakes(onlyActive,fieldname,fieldtype) {
  document.write('<OPTION VALUE="">Make</OPTION>\n');
  for (var i = 0; i != makes.length; i++) {
    var make = makes[i];
    if ((onlyActive == 0 || make.active == 1)) {
      document.write('<OPTION VALUE="' + make.code + '">' + make.name + '</OPTION>\n');
    }
  }
}
