// Check browser version
var init = 0;

if (document.images) {
  var colors = new Array('All');
  var model_trims = new Array();
  model_trims['Any-Any'] = new Array(
    'All',
    'Naples Gold Metallic',
    'Vermont Green Pearl',
    'Monterey Blue Pearl',
    'Ruby Red Pearl',
    'Sebring Silver Pearl',
    'Nighthawk Black Pearl',
    'Premium White Pearl',
    'Dark Emerald Pearl',
    'Satin Silver Metallic',
    'Naples Gold Metallic',
    'White Diamond Pearl',
    'Firepepper Red',
    'White Taffeta',
    'Laguna Green Metallic',
    'Monterey Blue Pearl',
    'Nighthawk Black Pearl',
    'Dark Emerald Pearl',
    'Monterey Blue',
    'Naples Gold',
    'Nighthawk Black',
    'Satin Silver',
    'Taffeta White',
    'San Marino Red',
    'Sundance Gold',
    'Nighthawk Black',
    'Satin Silver',
    'Taffeta White',
    'Flamenco Black Pearl',
    'Taffeta White',
    'Clover Green Pearl',
    'Vogue Silver Metallic',
    'Voltage Blue Metallic',
    'Cayenne Red Pearl',
    'Milano Red',
    'Clover Green Pearl',
    'Vogue Silver Metallic',
    'Flamenco Black Pearl',
    'Taffeta White',
    'Milano Red',
    'Clover Green Pearl',
    'Dark Violet Pearl',
    'Grand Prix White',
    'New Formula Red',
    'Spa Yellow Pearl',
    'Silverstone Metallic',
    'Monaco Blue Pearl',
    'Berlina Black',
    'Grand Prix White',
    'New Formula Red',
    'Spa Yellow Pearl',
    'Silverstone Metallic',
    'Monaco Blue Pearl',
    'Berlina Black',
    'Nighthawk Black Pearl',
    'Dark Emerald Pearl',
    'Deep Mahogany Pearl',
    'Granite Green Metallic',
    'Mesa Beige Metallic',
    'Starlight Silver Metallic'
  );
  model_trims['RL-Any'] = new Array(
    'All',
    'Naples Gold Metallic',
    'Vermont Green Pearl',
    'Monterey Blue Pearl',
    'Ruby Red Pearl',
    'Sebring Silver Pearl',
    'Nighthawk Black Pearl',
    'Premium White Pearl'
  );
  model_trims['RL-3.5'] = new Array(
    'All',
    'Naples Gold Metallic',
    'Vermont Green Pearl',
    'Monterey Blue Pearl',
    'Ruby Red Pearl',
    'Sebring Silver Pearl',
    'Nighthawk Black Pearl',
    'Premium White Pearl'
  );
  model_trims['TL-Any'] = new Array(
    'All',
    'Dark Emerald Pearl',
    'Satin Silver Metallic',
    'Naples Gold Metallic',
    'White Diamond Pearl',
    'Firepepper Red',
    'White Taffeta',
    'Laguna Green Metallic',
    'Monterey Blue Pearl',
    'Nighthawk Black Pearl'
  );
  model_trims['TL-3.2'] = new Array(
    'All',
    'Dark Emerald Pearl',
    'Satin Silver Metallic',
    'Naples Gold Metallic',
    'White Diamond Pearl',
    'Firepepper Red',
    'White Taffeta',
    'Laguna Green Metallic',
    'Monterey Blue Pearl',
    'Nighthawk Black Pearl'
  );
  model_trims['CL-Any'] = new Array(
    'All',
    'Dark Emerald Pearl',
    'Monterey Blue',
    'Naples Gold',
    'San Marino Red',
    'Sundance Gold',
    'Nighthawk Black',
    'Satin Silver',
    'Taffeta White'
  );
  model_trims['CL-3.2'] = new Array(
    'All',
    'Dark Emerald Pearl',
    'Monterey Blue',
    'Naples Gold',
    'Nighthawk Black',
    'Satin Silver',
    'Taffeta White'
  );
  model_trims['CL-3.2 Type S'] = new Array(
    'All',
    'San Marino Red',
    'Sundance Gold',
    'Nighthawk Black',
    'Satin Silver',
    'Taffeta White'
  );
  model_trims['Integra-Any'] = new Array(
    'All',
    'Flamenco Black Pearl',
    'Taffeta White',
    'Milano Red',
    'Clover Green Pearl',
    'Vogue Silver Metallic',
    'Voltage Blue Metallic',
    'Cayenne Red Pearl',
    'Dark Violet Pearl'
  );
  model_trims['Integra-LS'] = new Array(
    'All',
    'Flamenco Black Pearl',
    'Taffeta White',
    'Clover Green Pearl',
    'Vogue Silver Metallic',
    'Voltage Blue Metallic',
    'Cayenne Red Pearl'
  );
  model_trims['Integra-GS'] = new Array(
    'All',
    'Milano Red',
    'Clover Green Pearl',
    'Vogue Silver Metallic'
  );
  model_trims['Integra-GS-R'] = new Array(
    'All',
    'Flamenco Black Pearl',
    'Taffeta White',
    'Milano Red',
    'Clover Green Pearl',
    'Dark Violet Pearl'
  );
  model_trims['NSX-Any'] = new Array(
    'All',
    'Grand Prix White',
    'New Formula Red',
    'Spa Yellow Pearl',
    'Silverstone Metallic',
    'Monaco Blue Pearl',
    'Berlina Black'
  );
  model_trims['NSX-3.2'] = new Array(
    'All',
    'Grand Prix White',
    'New Formula Red',
    'Spa Yellow Pearl',
    'Silverstone Metallic',
    'Monaco Blue Pearl',
    'Berlina Black'
  );
  model_trims['NSX-3.0'] = new Array(
    'All',
    'Grand Prix White',
    'New Formula Red',
    'Spa Yellow Pearl',
    'Silverstone Metallic',
    'Monaco Blue Pearl',
    'Berlina Black'
  );
  model_trims['MDX-Any'] = new Array(
    'All',
    'Nighthawk Black Pearl',
    'Dark Emerald Pearl',
    'Deep Mahogany Pearl',
    'Granite Green Metallic',
    'Mesa Beige Metallic',
    'Starlight Silver Metallic'
  );

  model_trims['RSX-Any'] = new Array(
     'All',
     'Taffeta White',
     'Nighthawk Black',
     'Firepepper Red',
     'Satin Silver',
     'Desert Silver',
     'Eternal Blue'
   );

}

function populate_colors() {
   if(document.images) {
   //if(new Array()) {
        var local_array = new Array();

        // get selected model option
        var idx   = document.inv.model.selectedIndex
        var model = document.inv.model.options[idx].value;

        // get any previous selected trim info
        var trim_idx = document.inv.trim.selectedIndex;
        var trim = document.inv.trim.options[trim_idx].value;

        if (trim_idx == 0) {
          trim = 'Any';
        }

        // reset color options
        document.inv.colext.length = 0;

        var model_trim = model + '-' + trim;
        // Get generic instance of the proper colors array
        if (idx == 0) {
          local_array = colors;
        } else {
          local_array = model_trims[model_trim];
        }

        var selected_idx = 0;
        for (opt in local_array) {

           var display = local_array[opt];
           var value = '';
           if (display != 'Any') {
             value = local_array[opt];
           }
           document.inv.colext.options[document.inv.colext.options.length] = new Option(display,
                value );
        }
        //document.inv.colext.options[selected_idx].selected = "true";
	//populate_trims();

   } else {
        return 0;
   }
}
