// Copyright MB TechDesk (www.techdesk.com.au)

var category = new Array();
category["Please select from options below"] = new Array("Please select from options below");
category["Bus"] = new Array("Please select from options below","Volvo", "Scania", "Mercedes", "MAN");
category["Truck"] = new Array("Please select from options below","Volvo", "Mack", "Mitsubishi", "Isuzu", "Hino", "Kenworth", "Nissan UD", "Scania", "Mercedes", "MAN");

category["Bus"]["Volvo"] = new Array("Please select from options below","B10B", "B10C", "B10L", "B10M", "B10R", "B57", "B58", "B59", "B6", "B7", "B12B", "B12BLE", "B7R", "B7RLE", "Other");
category["Bus"]["Scania"] = new Array("Please select from options below","K112", "K113", "K82", "K92", "K93", "K94", "L113", "N112", "N113", "Other ");
category["Bus"]["Mercedes"] = new Array("Please select from options below","0302", "0303", "0305", "0400", "0404", "0405", "0812", "0814", "1315", "1316", "1418", "1617", "1621", "1622", "1625", "1630", "811", "814", "815", "Other");
category["Bus"]["MAN"] = new Array("Please select from options below","10.150HOCL", "10.155HOCL", "10.160FOCL", "10.180HOCL", "10.220FOCL", "11.152HOCL", "11.190HOCL", "11.220HOCL", "11.230HOCL", "12.220HOCL-NL", "14.190HOCL", "14.230HOCL", "15.220HOUCL-NL", "16.240HOC", "16.240HOCL", "16.240UOCL", "16.242HOUCL", "16.280HOCL", "16.290HOCL", "18.220FOC", "18.232HOCL", "18.250HOCL", "18.310HOCL", "18.370HOCL", "22.280HOCLN", "22.321HOCLN", "22.342HOCLH", "22.360HOCLR", "22.370HOCLN", "24.420HOCLN", "8.160FOCL", "NL202", "SG192", "SG220", "SG280", "SL200", "SL202", "Other");

category["Truck"]["Volvo"] = new Array("Please select from options below","F10", "F12", "F16", "F7", "F86", "F88", "FH12", "FH16", "FH580", "FL10", "FL12", "FL6", "FL7", "FM12", "FM7", "G88", "G89", "N10", "N12", "N7", "NH12", "NH14", "NL10", "NL12", "Other");
category["Truck"]["Mack"] = new Array("Please select from options below","Titan", "Magnum", "Trident", "CH Range", "Metro-Liner", "Qantum", "Midlum", "Other");
category["Truck"]["Mitsubishi"] = new Array("Please select from options below","FB511", "FC211", "FC212", "FC432", "FE211", "FE214", "FE334", "FE339", "FE434", "FE439", "FE444", "FE449", "FE537", "FE539", "FE637", "FE639", "FE647", "FE649", "FE657", "FE659", "FG434", "FG439", "FG637", "FG639", "FH100", "FK102", "FK115", "FK415", "FK417", "FK455", "FK457", "FK617", "FK618", "FM104", "FM215", "FM515", "FM517", "FM555", "FM557", "FM618", "FM657", "FM658", "FM677", "FP417", "FP418", "FP547", "FS427", "FS428", "FS527", "FV315", "FV358", "FV415", "FV417", "FV418", "FV458", "FV517", "FV547", "Other");
category["Truck"]["Isuzu"] = new Array("Please select from options below","CVR162TR", "CXG166TR", "CXH169TR", "CXZ164TR", "FRR32", "FRR33", "FSR11", "FSR12", "FSR32", "FSR33", "FSS12", "FSS33", "FTR11", "FTR12", "FTR32", "FTR33", "FTS12", "FTS33", "FVM13", "FVM23", "FVR11", "FVR12", "FVR13", "FVR23", "FVR32", "FVR33", "FVZ13", "FVZ23", "GVR23", "HTS", "HTW", "JBR", "JCR", "JCS", "KS11", "KS21", "KS32", "KT25", "KT26", "NKR57", "NKR58", "NKR66", "NKR69", "NPR57", "NPR58", "NPR59", "NPR66", "NPR71", "NPS59", "NPS66", "NPS71", "NQR70", "SBR", "SCR", "SHG", "SHH", "SHR", "SHZ", "SPG", "SPH", "SPZ", "TLD", "Other");
category["Truck"]["Hino"] = new Array("Please select from options below","FC142K", "FC144K", "FC146K", "FD164L", "FD166L", "FD171K", "FD174K", "FD176K", "FF172K", "FF172L", "FF173K", "FF173L", "FF177K", "FF177L", "FF192K", "FF192L", "FF193K", "FF193L", "FF197K", "FF197L", "FG172L", "FG173L", "FG175L", "FG177L", "FG192L", "FG193L", "FG195L", "FG197L", "FT163L", "FT165L", "GD164L", "GD166L", "GD174K", "GD176K", "GRIFFON", "GS221K", "GS224K", "GT173K", "GT173M", "GT175K", "GT175M", "HARRIER", "HAWK", "KESTREL", "KL300", "KL340", "KL360", "KR300", "KR320", "KR360", "LA540", "LA560", "LB500", "LB520", "LB560", "MERLIN", "OSPREY", "RANGER 10", "RANGER 14", "RANGER 4", "RANGER 5", "RANGER 50", "RANGER 5Z", "RANGER 6", "RANGER 6S", "RANGER 7", "RANGER 8", "RANGER 8Z", "RANGER 9", "RAVEN", "SHRIKE", "SUPER DOLPHIN", "SUPER EAGLE", "SUPER HAWK", "Other");
category["Truck"]["Kenworth"] = new Array("Please select from options below","K104 ", "T300", "T401", "T404", "C501", "T604", "T650", "T904", "T950", "Other");
category["Truck"]["Nissan UD"] = new Array("Please select from options below","CG320", "CG450", "CGA45", "CGA46", "CK10", "CK11", "CK290", "CK30", "CK320", "CK40", "CK450", "CKA45", "CKA46", "CLG87", "CLG88", "CM80", "CM90", "CMA81", "CMA86", "CMA87", "CMB87", "CMF87", "CMF88", "CPA87", "CPB12", "CPB14", "CPB87", "CPB88", "CPC12", "CPC14", "CPC15", "CV41", "CW240", "CW290", "CW320", "CW350", "CW40", "CW41", "CW420", "CW450", "CW50", "CW51", "CWA12", "CWA14", "CWA15", "CWA45", "CWA46", "CWA70", "CWA71", "LK185", "LK235", "MK150", "MK180", "MK185", "MK235", "PK220", "PK235", "PK240", "PK250", "TW50  ", "Other");
category["Truck"]["Scania"] = new Array("Please select from options below","110 Series", "111Series", "112H", "112M", "113H", "113M", "124G", "140 Series", "141 Series", "142H", "142M", "143H", "143M", "144G", "80 Series", "81 Series", "82H", "82M", "92H", "92M", "93H", "93M", "94D", "94G  ", "Other");
category["Truck"]["Mercedes"] = new Array("Please select from options below","1217", "1413", "1417", "1418", "1419", "1422", "1424", "1425", "1513", "1517", "1619", "1626", "1700MOG", "1719", "1734", "1924", "2024", "2219", "2222", "2224", "2224", "2225", "2226", "2228", "2232", "2233", "2235", "2236", "2238", "2433", "2434", "2435", "2534", "2550", "2624", "2628", "2632", "2635", "2636", "2638", "2643", "2648", "2650", "2822", "3228", "3233", "709", "911", "912", "Other");
category["Truck"]["MAN"] = new Array("Please select from options below","10.223", "12.223", "13.192NC", "15.168NC", "15.168NCA", "15.192NC", "15.192NCA", "15.240FCS", "15.280FCS", "16.192NCA", "20.192NC", "24.192FCTS", "25.256FCS", "25.280FC/S", "25.280NC", "25.280NCA", "25.281NCA", "25.320FCS", "25.321FC/S", "25.360FC/S", "26.240FCTS", "26.280FCTS", "26.281NCA", "26.321FCTS", "26.342GC/S", "26.362FC/S", "26.402FCS", "26.482FCS", "30.240FC", "30.280FCTS", "30.321FCTS", "30.321FCTSA", "30.342FCTS", "30.463FCTSA", "36.463FCTSA", "Other");

function updateMake(form) {
  var i=0;
  strCategory=form.category[form.category.selectedIndex].value;
  form.aa.value=form.category.selectedIndex;
  form.make.selectedIndex=-1;
  form.make.length=0;
  form.model.length=0;

  if (strCategory == "Please select from options below") {
    form.make.length++;
    form.make.options[i]=new Option("Please select a category", "Please select a category");
    form.bb.value=0;
    form.model.length++;
    form.model.options[i]=new Option("Please select a category", "Please select a category");
    form.cc.value=0;
  }
  else {
    form.model.length++;
    form.model.options[i]=new Option("Please select a make", "Please select a make");
    while(i<category[strCategory].length) {
      form.make.length++;
      form.make.options[i]=new Option(category[strCategory][i], category[strCategory][i]);
      
      i++;
    }
  }
  form.make.options[0].selected = true;
  form.model.options[0].selected = true;
}

function updateModel(form)
{
  var i=0;
  var intSelected=0;
  strCategory=form.category[form.category.selectedIndex].value;
  strMake=form.make[form.make.selectedIndex].value;
  form.bb.value=form.make.selectedIndex;
  form.model.selectedIndex=-1;
  form.model.length=0;
  if (strMake == "Please select from options below") {
    form.model.length++;
    form.model.options[i]=new Option("Please select a make", "Please select a make");
  }
  else {
    while(i<category[strCategory][strMake].length)
    {
      form.model.length++;
      form.model.options[i]=new Option(category[strCategory][strMake][i], category[strCategory][strMake][i]);
      i++;
    }
  }
  form.model.options[0].selected = true;
}

function updateReload(form)
{
  
  if (form.aa.value>0) {
    form.category.options[form.aa.value].selected=true;
    updateMake(form)
  }
  if (form.bb.value>0) {
    form.make.options[form.bb.value].selected=true;
    updateModel(form)
  }
  if (form.cc.value>0) {
    form.model.options[form.cc.value].selected=true;
  }
}

function submitForm(form)
{
  form.cc.value=form.model.selectedIndex;
  form.submit();
}